Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
xiaq
on Feb 29, 2016
|
parent
|
context
|
favorite
| on:
C preprocessor tips and tricks
Enums can be used for that purpose.
_kst_
on Feb 29, 2016
[–]
True, but only for type int.
enum { MAX = 1000 };
J_Darnley
on March 1, 2016
|
parent
[–]
Why is this preferable over a preprocessor define? Is it because it can't be redefined easily? A max or count is certainly useful when there are other enum values but I don't see the huge advantage it has here.
_kst_
on March 1, 2016
|
root
|
parent
[–]
Enumeration constants have scope.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: