5 ms·
'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 'vsnprin
by aji 11y ago
'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'?
- rossy 11y agoOr 'tmpfile' and 'tmpnam'. Gotta save those characters. 'tempfile' and 'tempname' would be to hard to type. (Also, why not 'tmpfil'?)
- to3m 11y agoThe number of significant characters in an extern symbol was only upgraded to 31 with C99... prior to that, it was all of 6.
- sgt 11y agoThis 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 http://flash-gordon.me.uk/ansi.c.txt
- kbutler 11y agocreat
- Gibbon1 11y agoCourse 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
- annnnd 11y agoAlso, 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.
- timlyo 11y agoMaybe 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.
- dkersten 11y agoAlso, if you glance at them, strcpy and strncpy look identical, which I find can be problematic.
- ucho 11y agoI 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.