On Thu, 29 Jan 2004 20:27:57 -0500, John Ratliff <jd*@nospam.net>
wrote in comp.lang.c++:
Victor Bazarov wrote: "John Ratliff" <jd******@technoplaza.net> wrote...
Let's say I had a program which uses some constants. Would it be
"better" to declare them like this:
#ifndef __MY_HDR_FILE
#define __MY_HDR_FILE
Try to NEVER use double underscores or underscores followed by
a capital letter. Such stuff is reserved by language implementors.
So, for private header files, use single underscore then?
No, in general it is easiest to avoid all leading underscores.
Specifically the standard reserves any identifier beginning with an
underscore and upper case letter, or double underscores anywhere,
under all circumstances.
An identifier starting with a single underscore followed by a
lowercase are a problem in some cases, and OK in other cases. It is
easier to avoid them than to remember the rules.
What's the matter with just:
#ifndef MY_HDR_FILE
#define MY_HDR_FILE
/* stuff */
#endif
....what do you think the leading underscored do to improve your
program.
Why do you think you need leading underscores at all? Programmers
blindly copy this, which they often see in headers supplied by their
compiler, because they think it's "kewl" or something. They just
don't realize that compiler vendors use these patterns specifically
because they are reserved for the compiler, and won't ever conflict
with identifiers generated by programmers who know the rules.
--
Jack Klein
Home:
http://JK-Technology.Com
FAQs for
comp.lang.c
http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++
http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html