stdio.h & sprintf question

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Jun 9 07:01:23 AEST 1990


In article <HARKCOM.90Jun8175943 at potato.pa.Yokogawa.CO.JP> harkcom at potato.pa.Yokogawa.CO.JP (Alton Harkcom) writes:
>char    *sprintf();             /* too painful to do right */

This is an artifact from an early implementation of sprintf() that
happened to leave the buffer address in the function return register,
so some applications eventually started relying on it.  On non-BSD
systems sprintf() eventually was changed from an accidental void-
valued function that happened to act like a char*-valued one to a
deliberately int-valued one, along with the rest of the *printf()
family.  While Berkeley didn't follow this trend for quite a while,
because as the comment indicates it would require tracking down all
uses in applications and fixing them, I think 4.4BSD plans to track
the C standard, which specifies int-valued.



More information about the Comp.unix.questions mailing list