3 ms·
Funny enough, the take on const in the only thing I agree with in the whole post…
by f1shy 3y ago
Funny enough, the take on const in the only thing I agree with in the whole post…
- rurban 3y agoI"m even not agreeing with the const part. The standard did define const API"s, so why shouldn"t we follow? I know that C const are only half of C++ consts, but still. Still catching const errors somewhere because I do use const in APIs. I only agree with "Declare all functions static except for entry points". s8(s) is only for literal strings, it should be called s8_c instead and keep s8 for the default ctor. The struct return part is okay, but I"ve never used. This is not Common Lisp.
- AdamH12113 3y agoCan you explain the static functions thing? What’s the benefit of declaring all functions static if you’re compiling them as a single translation unit anyway?
- f1shy 3y agoStatic means only visible for that translation unit. So they are not global. Only global inside the file.
- lelanthran 3y agoYou don't get the linker complain of multiply defined symbols when your code is linked in as a library to some other project. If you're writing code that never gets reused, then it's fine, no need for static functions.