On 8/4/17, Richard Ipsum <[email protected]> wrote: > On Fri, Aug 04, 2017 at 08:37:14AM -0700, Michael Forney wrote: >> You can't use identifiers that begin with '_', they are reserved for >> the C implementation: >> >> "All identifiers that begin with an underscore are always reserved for >> use as identifiers with file scope in both the ordinary and tag name >> spaces." > > This crossed my mind as well, but then we notice that these aren't > defined in file scope. If you have two underscores however that's > reserved regardless of use. > > "In addition to the names documented in this manual, reserved names include > all external identifiers (global functions and variables) that begin with an > underscore (‘_’) and all identifiers regardless of use that begin with > either two underscores or an underscore followed by a capital letter are > reserved names. This is so that the library and header files can define > functions, variables, and macros for internal purposes without risk of > conflict with names in user programs."[1]
Well, I guess these local variables could shadow a file-scope variable used by the C implementation, but I think it's better to avoid the names all-together. We wouldn't want to accidentally use the file-scope variable if a variable was renamed, but missed in one spot. > Thanks, > Richard > > [1]: https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html I think we should refer the C standard rather than the glibc manual (though in this case they say essentially the same thing). > -- > Life is too short for POSIX compliance
