Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Funny enough, the take on const in the only thing I agree with in the whole post…


I"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.


Can 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?


You 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.


Static means only visible for that translation unit. So they are not global. Only global inside the file.




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

Search: