May 04, 2024, 08:35:36 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


#DEFINE

Started by lviklund, January 27, 2006, 11:47:32 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lviklund

I am stuck.

How do I:

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

/Lasse

Bruce Peaslee

This works for me:

#define ONE 1
#define anotherOne ONE
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

lviklund

It works.
I don't know why it did not work in the first place.

Thank's Peaslee

Parker

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.

Zen

In IBasic i always wrote keywords in UPPERCASE. In Aurora i always write keywords in lowercase.

Lewis

Parker

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.

Bruce Peaslee

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.
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Parker

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.