Answer to Question #8467 in Other Programming & Computer Science for hatem el-azab
my question if anybody can explain to me ...why specifically the first 31 characters of an internal name are significant.
to make sense if i'm understand it correct in c99 the first 63 are significant is it because the all character combinations included in 63 characters as(26 for upper cases alpha,26 for small alpha,0-9 and 1 letter for universal letters)...if what i understand is correct so why 31.
To answer this question, first I need to mention some facts from the theory and the history of C language.
First of all, the C is a compiled language. So, before execution the source code& should& be translated into machine codes. This action is performed by compiler.& To transform C code into binaries for specific architecture, we should use the platform-specific compiler. C is intended to be cross-platform language. So the same C code should be accepted by different compilers without need of significant corrections. The compiler deals with numerous platform limitations. The limitation that directly concerns your question is system linker`s naming convention. The C standards were issued keeping in mind different system limitations to ensure code portability between architectures. The previous standard, the C 89 or ANSI C contained more strict rules for identifiers mentioned in your question: • Only 6 characters were significant (variables foobar and foobar1 were considered as the same variable) • Case& insensitivity (variables FOObar and fooBAR were considered as the same variable) Such limitations were implemented to keep portability with mainframe environments widely used those days. The next C99 standard reflects changes in popular architectures. The limitations became less strict, and& requirements for the internal identifiers followed them. But the same rule applies – if even specific OS supports longer identifiers names, we should stick to 31 character to keep portability with& other systems. List of references: http://stackoverflow.com/questions/2352209/max-identifier-length& - discussion& of topic on stackoverflow. http://home.datacomm.ch/t_wolf/tw/c/c9x_changes.html comparison between C89 and C9x http://publications.gbdirect.co.uk/c_book/chapter2/keywords_and_identifiers.html http://en.wikipedia.org/wiki/C_(programming_language) http://en.wikipedia.org/wiki/Compiled_language http://en.wikipedia.org/wiki/Compiler http://en.wikipedia.org/wiki/Linker_(computing) http://en.wikipedia.org/wiki/Naming_conventions_(programming)#Length_of_identifiers