Jump to content
Sign in to follow this  
emte

Pita Case Issue!

Recommended Posts

This is probably the .... (insert something here) problem i've found

so far.

 

This code "should" work, but generates an "Illegal Directive" error

that is far from useful in telling what the issue is.

 

#IF DEFINED(BOOSTC)

#ENDIF

void main(void)
{
   while(1);
}

 

If you change the first two lines to lowercase it works.

 

Unsure if this should be a bug or enhancement request i decided

on bug due to the un-helpful error message.

 

Please make the directive case-insensitive or change the warning

to reflect case sensitivity.

Share this post


Link to post
Share on other sites
This is probably the .... (insert something here) problem i've found

so far.

 

This code "should" work, but generates an "Illegal Directive" error

that is far from useful in telling what the issue is.

 

#IF DEFINED(BOOSTC)

#ENDIF

void main(void)
{
   while(1);
}

 

If you change the first two lines to lowercase it works.

 

Unsure if this should be a bug or enhancement request i decided

on bug due to the un-helpful error message.

 

Please make the directive case-insensitive or change the warning

to reflect case sensitivity.

 

 

I am pretty sure the ANSI C specification for preprocessor directives requires them to be lower case. I haven't been able to find a definitive statement that they are, but all examples and specifications show them as lower case, eg http://gcc.gnu.org/onlinedocs/gcc-2.95.3/cpp_1.html

 

Your uppercase version #IF is an unrecognised preprocessor directive, just like #BLAH would be, so the error message of "Illegal directive" seems correct. Maybe expanding the message to "Illegal preprocessor directive" would be marginally more descriptive, but I don't think there is anything wrong here.

 

It is a common convention for the macros defined to be in uppercase (like BOOSTC - except it shoud be _BOOSTC), but not the directives themselves.

 

Cheers

 

John

Share this post


Link to post
Share on other sites

C is case insensitive, hence no rule about it. It is used both ways though,

its only an imposed style that i came accross this issue.

 

Note that this is not an issue with #define or #pragma from what i recall.

Edited by emte

Share this post


Link to post
Share on other sites

I think you are wrong. C is very much case sensitive. The gcc compiler complains about #IFDEF as well. Use lower case. This is not a bug.

 

This is valid C code:

 

int main(int argc,char *argv[])
{
   int Hello,hello;

   Hello = 1;
   hello = 2;

   return(0);
}

Share this post


Link to post
Share on other sites

This should be fun then, the style outline i have to use specifies uppercase

for all these. Time to argue with the client.

 

Whee.

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...