Hacker News new | past | comments | ask | show | jobs | submit login

Enums can be used for that purpose.



True, but only for type int.

    enum { MAX = 1000 };


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.


Enumeration constants have scope.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: