Re:Modern C, Second Edition
by kazinator on Wednesday September 18, 2019 @09:59PM
(#21012506)
My perspective is that "const type" order consistently appears in all versions of the ISO C standard and POSIX.
Every major system API I can remember working with that didn't hide const behind a typedef (like Win32's LPCSTR and whatnot) has it const first.
Speaking of Microsoft, though the API's hide const with a typedef, the MSDN samples are predominantly "const char" order.
I've never seen a man page with "int const".
Searching all of the man pages I have installed on an Ubuntu 18 system here (literally grepping through all of /usr/share/man), I found just one with "char const" or "int const". Namely this one:
You just worked on some unusual code bases, and are glossing over the language and system API's those code bases depended on, and their respective docs.
Every major system API I can remember working with that didn't hide const behind a typedef (like Win32's LPCSTR and whatnot) has it const first.
Speaking of Microsoft, though the API's hide const with a typedef, the MSDN samples are predominantly "const char" order.
I've never seen a man page with "int const".
Searching all of the man pages I have installed on an Ubuntu 18 system here (literally grepping through all of /usr/share/man), I found just one with "char const" or "int const". Namely this one:
This contains: In the same man page, there are other declarations that have the predominant convention: You just worked on some unusual code bases, and are glossing over the language and system API's those code bases depended on, and their respective docs.