Jump to content

Is thare a alternative to the #define option in C++ ?


Recommended Posts

Posted

Hello,
When I was code things in C++,  Sometimes I used the #define option..
Is there something that doing this in Autoit ?
 

Posted

The equivalent of the C++ statment

#define MAX_NAME_LEN 80;

Would be this in AutoIt

Global Const MAX_NAME_LEN = 80

 

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Posted (edited)
17 minutes ago, Bowmore said:

The equivalent of the C++ statment

#define MAX_NAME_LEN 80;

Would be this in AutoIt

Global Const MAX_NAME_LEN = 80

 

It's not exactly the same.
In my case I need to access some value that inside array inside array inside array ...
And change it .. for example I have line like this:

(($aVids[$aVids_iDx1][$C_aVids_idx2_aOutPr])[($aVids[$aVids_iDx1][$C_aVids_idx2_aOutPr])[0][$C_PrMo_Fr_aOutData_idx2_0_ActiveID]][$C_PrMo_Fr_aOutData_idx2_aRanges])[0][0] ; = the size of the array

 

If I going to define it like this

Local Const $C_iSize = (($aVids[$aVids_iDx1][$C_aVids_idx2_aOutPr])[($aVids[$aVids_iDx1][$C_aVids_idx2_aOutPr])[0][$C_PrMo_Fr_aOutData_idx2_0_ActiveID]][$C_PrMo_Fr_aOutData_idx2_aRanges])[0][0]

And then I will try to change $C_iSize, it will not work. it will cause error, claiming I can't change $C_iSize.
But it is not $C_iSize that I want to change. but it is this giant line that it pointing to.

In C++ it will not complain.. Because #define is a a little different thing. (I hope you understand what's different)

Edited by Guest

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...