Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

'dup' is a bad example from C, in my opinion. ('dup' and 'dupe' are both short forms of 'duplicate' anyway.)

What about 'strncpy' versus 'strlcpy'? Or 'vsnprintf'? 'fcntl.h'? 'execlp'? 'EBADF'? 'SIGSEGV'? 'lstat'?



Course those come from a primordial age when max symbol sizes and file names were limited. Circa 1975 you were asking for trouble with a file name like string_copy.c or file_control.c


Also, I kind of like the short versions. They are not any more difficult to remember ("Hmm, was it CopyFile of FileCopy?") and you need to search for them the first time around anyway. And it does save the effort when typing.


I still don't remember if it is useradd or adduser - one is core linux command, other is script that also set ups home directory and stuff like that.


Maybe it's just me but I find the short ones much harder. Was it strnCopy or strCopy etc.

And I mostly use some form of auto complete so I'm not worried about the effort saved from typing.


Also, if you glance at them, strcpy and strncpy look identical, which I find can be problematic.


Or 'tmpfile' and 'tmpnam'. Gotta save those characters. 'tempfile' and 'tempname' would be to hard to type. (Also, why not 'tmpfil'?)


The number of significant characters in an extern symbol was only upgraded to 31 with C99... prior to that, it was all of 6.


This sounded a bit far-fetched so I did some digging. It is true that C89 had a maximum of 6 characters for external identifiers. C89 is often called ANSI C.

C89 says:

"The implementation shall treat at least the first 31 characters of an internal name (a macro name or an identifier that does not have external linkage) as significant. Corresponding lower-case and upper-case letters are different. The implementation may further restrict the significance of an external name (an identifier that has external linkage) to six characters and may ignore distinctions of alphabetical case for such names./10/ These limitations on identifiers are all implementation-defined."

Source: http://flash-gordon.me.uk/ansi.c.txt


creat




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: