Re: Index a #define string
Ioannis Vranos wrote:[color=blue]
> "Paul Mensonides" <leavings@comca st.net> wrote in message
> news:ncmdnezGp5 QscRjdRVn-jw@comcast.com. ..[color=green]
>>
>> No, not for constants. Use all caps identifiers for one thing and
>> one thing only--macro names. Constants, which I assume you to mean
>> constant variables or enumerators, should definitely *not* be all
>> caps--otherwise you just reintroduce the likelihood of a name clash.[/color]
>
>
> And now we are at the beginning of YARW (yet another "religious"
> war). I define all my constants in upper case, macros or no, so as it
> to be evident in code that i have to do with a constant.[/color]
This isn't a religious issue. It is a practical one. Macro names should be all
caps to distinguish them from everything else--for a very good reason. When you
use all caps for constants, you introduce a loophole into the protection
techniques that would otherwise never fail (at least not silently). If it
wasn't for the (valid) conventions regarding macro naming, I'd say that it is
merely a matter of subjective preference (such as "int *x" vs. "int* x", but it
isn't. It is a practical issue.
Regards,
Paul Mensonides
Ioannis Vranos wrote:[color=blue]
> "Paul Mensonides" <leavings@comca st.net> wrote in message
> news:ncmdnezGp5 QscRjdRVn-jw@comcast.com. ..[color=green]
>>
>> No, not for constants. Use all caps identifiers for one thing and
>> one thing only--macro names. Constants, which I assume you to mean
>> constant variables or enumerators, should definitely *not* be all
>> caps--otherwise you just reintroduce the likelihood of a name clash.[/color]
>
>
> And now we are at the beginning of YARW (yet another "religious"
> war). I define all my constants in upper case, macros or no, so as it
> to be evident in code that i have to do with a constant.[/color]
This isn't a religious issue. It is a practical one. Macro names should be all
caps to distinguish them from everything else--for a very good reason. When you
use all caps for constants, you introduce a loophole into the protection
techniques that would otherwise never fail (at least not silently). If it
wasn't for the (valid) conventions regarding macro naming, I'd say that it is
merely a matter of subjective preference (such as "int *x" vs. "int* x", but it
isn't. It is a practical issue.
Regards,
Paul Mensonides
Comment