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

> As for compiler time constants, you certainly can use them for those

No, you can't. In C, `const` variables are not constant expressions. This means you can't use them in case labels or to define the size of an array.

> Regarding libraries, see my other reply:

I know that there are several container libraries for C. I was only complaining that there is no standardized solution for the most basic data structures.




What you want is something is is exclusively for compiler time constants, rather than can merely use compiler time constants. I know I am being pedantic here, but that is an important distinction to make when dealing with computer programming languages, since the descriptions need to be free of ambiguity or there will be problems. What you had meant was unclear to me in your previous remarks. I understand now.


There is the trick: use enum for const. It works most of the time.


Yes, at least that's better than macros.


As for not having a standardized solution, sys/queue.h is the closest you will get to it. It would be nice if we had one, but it has not happened yet.




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

Search: