IonicWind Software

Aurora Compiler => General Discussion => Topic started by: lviklund on January 27, 2006, 11:47:32 AM

Title: #DEFINE
Post by: lviklund on January 27, 2006, 11:47:32 AM
I am stuck.

How do I:

#DEFINE FOO 1
#DEFINE BAR FOO <-------????

/Lasse
Title: Re: #DEFINE
Post by: Bruce Peaslee on January 27, 2006, 11:52:52 AM
This works for me:

#define ONE 1
#define anotherOne ONE
Title: Re: #DEFINE
Post by: lviklund on January 27, 2006, 12:13:51 PM
It works.
I don't know why it did not work in the first place.

Thank's Peaslee
Title: Re: #DEFINE
Post by: Parker on January 27, 2006, 02:40:46 PM
I wouldn't think so, but maybe it's the case of the #define keyword? I always type keywords in lower case so I don't know. Or maybe there was an error somewhere else causing it to fail.
Title: Re: #DEFINE
Post by: Zen on January 28, 2006, 02:09:35 AM
In IBasic i always wrote keywords in UPPERCASE. In Aurora i always write keywords in lowercase.

Lewis
Title: Re: #DEFINE
Post by: Parker on January 28, 2006, 11:07:43 AM
That's a BASIC thing, I don't know how the convention came around. Maybe to distinguish keywords from functions since you didn't have to use parenthesis. But I always found it a pain to hold down shift ;) Although I did write @CAPTION and others like that, probably because of the windows API's constant convention.

But I really don't think it would make any difference since you usually would just tell the lexer to be case insensitive, then it compares lowercase or uppercase characters, so wHiLe is the same as while or WHILE. Of course in C all three are different and it would make a difference.

That is a strange problem, but if it's working now it was probably an oddity in the code somewhere else causing the parser to do something weird or not recognize it. If there was an error or unsupported feature in the "#define FOO" part it would fail since FOO wouldn't actually be defined.
Title: Re: #DEFINE
Post by: Bruce Peaslee on January 28, 2006, 11:16:40 AM
The only thing I've found to be case sensative in Aurora is the following:



This construction is case sensative:

class MyMapWindow : MDIChildWnd
{
ÂÃ,  declareÂÃ,  MyMapWindow();ÂÃ,  ÂÃ,  // not myMapWindow !!!
ÂÃ,  declare _MyMapWindow();
}

It was a hard error to catch!ÂÃ,  ÂÃ, 




My convention is to type reserved words in lower case. They appear in color and that is enough emphasis for me.
Title: Re: #DEFINE
Post by: Parker on January 28, 2006, 11:22:56 AM
The reason those are case sensitive is because of the way the compiler is case insensitive ;)

Some compilers shift all the identifiers to lowercase or uppercase, but Aurora keeps the case and does some matching when you use a variable or subroutine that has already been declared. The class constructor has to match the class name exactly because when NEW() is called the compiler doesn't look for your constructor, it just calls ClassName@ClassName. The destructor is the same.

The other thing that's case sensitive (I'd assume at least since it was in Pro) are gotos and labels since they are just copied directly to the assembly file.