Naming convention of standard C functions/types

Just a general knowledge question:

Is there a reason why the functions and data types in standard C are so short, and often cryptic? For example, back when I was a little kid using Windows 3.1, file names were limited to a root of 8 characters. Is there a similar legacy for C functions, presumably due to the age of the language, or is there some other rationale for this?

Thanks!

Last edited on
I dont think so but schools usualy teach students to be descriptive when it comes to naming ... presumably to avoid mistakes like Windows 3.1
They should be easy to remember and fast to type, why do you find them cryptic?
http://en.wikipedia.org/wiki/Naming_conventions_%28programming%29#C_and_C.2B.2B_languages

( The 8 character filenames was only because DOS was crappy http://en.wikipedia.org/wiki/8.3_filename )
Last edited on
All names were initially quite short because memory was at a premium and the people who made up names thought they were easier to type. Hence exec rather than CreateProcess and so on.

But the names you're talking about have nothing to do with C. They are a limitation of the MS-DOS file system's 8.3 file naming convention.
The reason standard C library names are so short is that older versions of the standard did not specify a particularly large number of 'remembered' characters in identifier names -- and as often as not, older compilers didn't give much more than six or eight significant characters. (All this, as kbw said, because of low memory availability.) Hence, names were kept short to avoid problems with names like (given five significant characters for identifier names):

eat_peas()
eat_poo()

In such programs, both identifiers are saved as "eat_p". The linker can then be as creative as it likes when deciding which you meant when putting together your executable.

(Keep in mind that I used five significant characters just for example purposes -- usually it was between eight and ten.)

Modern standards require an identifier to have at least 31 significant characters. Modern compilers do that, and don't make any special efforts to break old code with a smaller number of significant characters.


Also, as Bazzy said, the short naming convention was typical of programming style and thought for the time.

Hope this helps.
Topic archived. No new replies allowed.