Mail Archives: djgpp/2005/09/08/14:35:34
------=_Part_32031_25140406.1126204478396
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Is chaf[100] maybe really something like char *chaf; which is not really=20
malloced? or maybe freed early, that would crash.
On 8 Sep 2005 11:59:17 GMT, Hans-Bernhard Broeker <
broeker AT physik DOT rwth-aachen DOT de> wrote:
>=20
> Joe Wright <jwright AT comcast DOT net> wrote:
>=20
> > What could sprintf() do with malloc()?
>=20
> Construct itself a temporary buffer to work in --- the output buffer
> may not be large enough.
>=20
> If sprintf() were a standalone "real" function that does all the work
> itself, it probably wouldn't need that. But in modern C runtimes,
> sprintf() may well be a specialization of vsnprintf(), which may a
> need a buffer to do its job. Or sprintf() could be implemented via an
> in-memory pseudo file, i.e. it may need to construct a FILE * to pass
> to the underlying generic routines.
>=20
> --
> Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
> Even if all the snow were burnt, ashes would remain.
>
------=_Part_32031_25140406.1126204478396
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Is chaf[100] maybe really something like char *chaf; which is not really ma=
lloced? or maybe freed early, that would crash.<br><br><div><span cla=
ss=3D"gmail_quote">On 8 Sep 2005 11:59:17 GMT, <b class=3D"gmail_sendername=
">Hans-Bernhard Broeker
</b> <<a href=3D"mailto:broeker AT physik DOT rwth-aachen DOT de">broeker AT physik DOT rw=
th-aachen.de</a>> wrote:</span><blockquote class=3D"gmail_quote" style=
=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; p=
adding-left: 1ex;">
Joe Wright <<a href=3D"mailto:jwright AT comcast DOT net">jwright AT comcast DOT net</=
a>> wrote:<br><br>> What could sprintf() do with malloc()?<br><br>Con=
struct itself a temporary buffer to work in --- the output buffer<br>may no=
t be large enough.
<br><br>If sprintf() were a standalone "real" function that does =
all the work<br>itself, it probably wouldn't need that. But in m=
odern C runtimes,<br>sprintf() may well be a specialization of vsnprintf(),=
which may a
<br>need a buffer to do its job. Or sprintf() could be implement=
ed via an<br>in-memory pseudo file, i.e. it may need to construct a FILE * =
to pass<br>to the underlying generic routines.<br><br>--<br>Hans-Bernhard B=
roeker (
<a href=3D"mailto:broeker AT physik DOT rwth-aachen DOT de">broeker AT physik DOT rwth-aachen=
.de</a>)<br>Even if all the snow were burnt, ashes would remain.<br></block=
quote></div><br>
------=_Part_32031_25140406.1126204478396--
- Raw text -