> There's surely no excuse for this
The "excuse" is greppability since static has three completely different meanings in C and the desire to clearly denote global variables is fairly common. The same reasoning goes for the cast define as well.
Whether you find value in these small abuses of the preprocessor depends on your coding habits, but I don't really see much reason to criticize them. If the author finds them helpful, what's the harm? There isn't much room for confusion and they're not forced on the users of the library.
Re:ZPL: (Almost) C99 Powerkit
by up2isomorphism on Saturday March 20, 2021 @02:31PM
(#26524999)
These extra wrappers are most likely when library writer trying to cover windows platform, which has almost never been a good place for ANSI C programming.
I'm not sure what the advantage of the following is vs. just setting the bits using & and | which every C programmer should already be familiar with:
There's surely no excuse for this: While a lot of the library looks useful, stuff like the above makes it feel like it's written by somebody who knows C, but doesn't feel fully comfortable writing it.[1]: https://github.com/zpl-c/zpl/blob/master/code/header/essenti...
[2]: https://github.com/zpl-c/zpl/blob/27c80bd5807da5238777bfcba8...