3 ms·
You can build with -Werror like the rest of us to get a compiler error instead of a warning. As for compiler time constants, you certainly can use them for tho
by ryao 2y ago
You can build with -Werror like the rest of us to get a compiler error instead of a warning.
As for compiler time constants, you certainly can use them for those, but the compiler will happily identify constants without the const keyword, whose true purpose is to cause a build time error if you try to modify it.
Regarding libraries, see my other reply:
https://news.ycombinator.com/item?id=42506570 https://news.ycombinator.com/item?id=42506570
Libuutil is a system library that is on any system that uses ZFS, although there are no known external consumers, so if you are interested in being the first, feel free to open bug reports with OpenZFS asking for removed functionality to be restored if you want any of it.
- spacechild1 2y ago> 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.
- funny_falcon 2y agoThere is the trick: use enum for const. It works most of the time.
- spacechild1 2y agoYes, at least that's better than macros.
- ryao 2y agoWhat 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.
- ryao 2y agoAs 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.