Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Off topic: reserved identifiers in C

Author: Heiner Marxen

Date: 13:23:41 02/15/00

Go up one level in this thread


On February 15, 2000 at 16:02:05, Daniel Clausen wrote:

>Hi
>
>On February 15, 2000 at 12:50:46, Heiner Marxen wrote:
>>>  Note that a lot of people often use _MYHEADERFILE_H_ instead. (only one
>>>  leading/trailing underscore) While this may work fine in most cases, it's
>>>  not nice, since symbols starting with 1 underscore belong to the compilers
>>>  namespace.
>>
>>7.1.3 Reserved identifiers
>>
>>All identifiers that begin with an underscore and either an uppercase
>>letter or another underscore are always reserved for any use.
>>
>>Heiner
>
>Many thanks for correcting. I think it's about time now that I get a copy
>of the Ansi-C standard. :) After some thought I think the underscore stuff
>shouldn't be important here, since only the preprocessor sees them. The
>compiler itself will never see them. Maybe the term "...reserved for any
>use" only applies to the compiler itself? Or also to the preprocessor?
>Or am I missing something?

"for any use" includes the preprocessor.  Such names may be used by
standard headers internally, or even have some magic meaning.
Just never use such identifiers yourself.  When I want identifiers
of this type I sometimes append underscores at the end, like:

#ifndef CHEST_acm_h_INCLUDED__

That pretty much avoids conflicts with "normal" names.

Heiner

>Kind regards,
> -sargon
>
>PS. Sorry for the a-lil-bit-offtopic-post.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.