This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On Wed, May 9, 2012 at 9:41 AM, Carlos O'Donell<carlos@systemhalted.org> wrote:As a GCC developer, I can make an argument for either approach and which is best would be highly dependent on the context.Please use an enum. Magic constants are difficult to understand.
Everyone understands:
if (var == NAMED_STATE)
Nobody understands:
if (var<= 0)
... until they go and read the comment which describes two states at 1, and -1.
If you argue that the compiler does a better job with<= 0 then please hide it behind a macro.
e.g. if (NAMED_STATE(var))
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |