Use of double underscore in C -
i studying c programming modern approach book. found question in it:
why not idea identifier contain more 1 adjacent underscore (as in current__balance example)?
can explain me why so?
identifiers begin 2 underscores or underscore , capital letter reserved c standard , should not used in own code, cf. iso 9899:2011 §7.1.3 ¶1 #1:
7.1.3 reserved identifiers
1 each header declares or defines identifiers listed in associated subclause, , optionally declares or defines identifiers listed in associated future library directions subclause , identifiers reserved either use or use file scope identifiers.
- all identifiers begin underscore , either uppercase letter or underscore reserved use.
- all identifiers begin underscore reserved use identifiers file scope in both ordinary , tag name spaces.
- each macro name in of following subclauses (including future library directions) reserved use specified if of associated headers included; unless explicitly stated otherwise (see 7.1.4).
- all identifiers external linkage in of following subclauses (including future library directions) ,
errnoreserved use identifiers external linkage.184)- each identifier file scope listed in of following subclauses (including future library directions) reserved use macro name , identifier file scope in same name space if of associated headers included.
2 no other identifiers reserved. if program declares or defines identifier in context in reserved (other allowed 7.1.4), or defines reserved identifier macro name, behavior undefined.
3 if program removes (with
#undef) macro definition of identifier in first group listed above, behavior undefined.
184) the list of reserved identifiers external linkage includes
math_errhandling,setjm,va_copy, ,va_end.
for double underscores inside names: these hard tell apart single underscores in many typefaces , lead confusion. recommend avoid doing that.
Comments
Post a Comment