Re: Is there a convention mandating macros to be all-uppper-case?
- From: "Victor Bazarov" <v.Abazarov@xxxxxxxxxxxx>
- Date: Fri, 19 May 2006 12:30:58 -0400
ultranet wrote:
"Ulrich Eckhardt" wrote:
I may add that the (very good!) book "C++ Coding Standards" by
Sutter and Alexandrescu suggest that a) all macros are uppercase and
b) only macros are uppercase for that very reason. However, there is
existing practice to make constants from both constant objects and
enumerations all uppercase and assert() isn't uppercase either,
although it should.
How would you change the following enum?
enum eMyEnum {
eINVOKE,
eINVOKE_AND_WAIT
};
I'd like to make it clear that each constant is an enum member,
I've not seen a worse instance of Hungarian Notation Syndrome.
If you need to isolate those constants, a better way would be
struct InvocationType {
enum type { INVOKE, INVOKE_AND_WAIT };
};
... InvocationType::INVOKE ...
The fact that it's right after the scope resolution should tell everybody
interested to know that it's not a macro.
by
using EINVOKE would look like an error. I'm not sure about standard
headers, but in other headers i see some like above, and some
all-cap, w/o e, like INVOKE.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.
- References:
- Re: Is there a convention mandating macros to be all-uppper-case?
- From: Ulrich Eckhardt
- Re: Is there a convention mandating macros to be all-uppper-case?
- From: Ulrich Eckhardt
- Re: Is there a convention mandating macros to be all-uppper-case?
- Prev by Date: Re: boost::variant and VC debugger
- Next by Date: Re: Is there a convention mandating macros to be all-uppper-case?
- Previous by thread: Re: Is there a convention mandating macros to be all-uppper-case?
- Next by thread: Re: Is there a convention mandating macros to be all-uppper-case?
- Index(es):
Relevant Pages
|