4 ms·
They could: -use more obscure letter combinations than "is", "to" and "str" which are very common beginnings of words. How do "is", "to" and "str" help anyway
by Aardwolf 4y ago
They could:
-use more obscure letter combinations than "is", "to" and "str" which are very common beginnings of words. How do "is", "to" and "str" help anyway if they want to add functionality that has no sensible name starting with those?
-use two underscores at the beginning since as per the article that is already reserved
-use stdc_ as prefix
- codeflo 4y agoOr introduce them as __newfunction for the linker, but have a new optional header file that #defines the short name. That’s the route that was chosen for C99’s _Bool/bool (there it was a typedef), and it worked well AFAIK.
- layer8 4y agoThe drawback of the macro solution is that it also disables those names for static symbols and struct members etc. when the header is included. For bool this was okay as it was intended as an opt-in keyword and the header was a new one, but doing that for all functions and in existing headers would potentially break more code.
- pmontra 4y agoI really hate leading underscores, in every language. stc_ or similar prefixes is the way to go.
- int_19h 4y agoStuff like "isalpha", "tolower", and "strlen" long predates standardization of C, so they had to work with what they already had.