4 ms·
It's surprising to me that you think char arrays might be unfamiliar to C developers!
by cjaybo 6y ago
It's surprising to me that you think char arrays might be unfamiliar to C developers!
- nyellin 6y agoI should have been more clear. It's not that developers are unfamiliar with the string/array equivalence in C, but rather it's less common to encode constant strings that way and I've rarely seen it done. I can find data showing that adding the second const is uncommon. Here are the number of code results for different github searches: "const char " - 310 million results "const char" - 385 million results "const char * const" - 30 million results "const char* const" - 37 million results "const char *const" - 36 million results Unfortunately I'm not sure how to search for the array style syntax. One way or another, my point is that I'm more interested in optimizing for readablity and the way people expect things to be defined rather than the extra bytes.
- s_gourichon 6y agoThe better syntax being uncommon is not a reason to not adopt it. Sometimes the wide majority can be unaware of the better choice. I would rather see the change suggested as an opportunity to educate the developers.