_print/_doprnt; curses on sys III
Geoff Collyer
geoff at utcsstat.UUCP
Tue Jun 19 03:57:22 AEST 1984
Programs that rely on the internals of a given stdio implementation are
certainly grossly non-portable, but more importantly they are
*BROKEN*. By using _doprnt, you are assuming that there exists a
function in every stdio implementation similar to _doprnt in Dennis
Ritchie's implementation. If such a function exists, it may be static
and thus inaccessible, but it may not even exist.
Defending existing programs on the grounds that they seem to work
doesn't stand up to a moment's reflection; plenty of buggy programs
have appeared to work due to flukes: the v7 mv called strcat to append
to an uninitialised auto char array. Such behaviour was clearly a bug
and deserved to be fixed; mv was broken, not just unportable.
Sometimes correct code (using sprintf) is a bit longer than incorrect
code (using stdio internals). Redeclaration of putc is ``perilous''
(stdio(3S)). I fail to see why putc needs to be redefined.
More information about the Comp.unix.wizards
mailing list