Mail Archives: djgpp/2005/09/09/05:31:15
This is a multi-part message in MIME format.
------=_NextPart_000_00BC_01C5B531.43ECBB20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Chaf[100] is defined in static.
"Matthew Petricone" <strstream AT gmail DOT com> a =E9crit dans le message de =
news: 2497d9a205090811344d981e1 AT mail DOT gmail DOT com...
Is chaf[100] maybe really something like char *chaf; which is not =
really 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:
Joe Wright <jwright AT comcast DOT net> wrote:
> What could sprintf() do with malloc()?
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=20
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.
--
Hans-Bernhard Broeker ( broeker AT physik DOT rwth-aachende)
Even if all the snow were burnt, ashes would remain.
------=_NextPart_000_00BC_01C5B531.43ECBB20
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Chaf[100] is defined in =
static.</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Matthew Petricone" <<A=20
href=3D"mailto:strstream AT gmail DOT com">strstream AT gmail DOT com</A>> a =
=E9crit dans le=20
message de news: <A=20
=
href=3D"mailto:2497d9a205090811344d981e1 AT mail DOT gmail DOT com">2497d9a205090811=
344d981e1 AT mail DOT gmail DOT com</A>...</DIV>Is=20
chaf[100] maybe really something like char *chaf; which is not really=20
malloced? or maybe freed early, that would crash.<BR><BR>
<DIV><SPAN class=3Dgmail_quote>On 8 Sep 2005 11:59:17 GMT, <B=20
class=3Dgmail_sendername>Hans-Bernhard Broeker </B><<A=20
=
href=3D"mailto:broeker AT physik DOT rwth-aachen DOT de">broeker AT physik DOT rwth-aachen.=
de</A>>=20
wrote:</SPAN>
<BLOCKQUOTE class=3Dgmail_quote=20
style=3D"PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: =
rgb(204,204,204) 1px solid">Joe=20
Wright <<A =
href=3D"mailto:jwright AT comcast DOT net">jwright AT comcast DOT net</A>>=20
wrote:<BR><BR>> What could sprintf() do with =
malloc()?<BR><BR>Construct=20
itself a temporary buffer to work in --- the output buffer<BR>may =
not be=20
large enough. <BR><BR>If sprintf() were a standalone "real" function =
that=20
does all the work<BR>itself, it probably wouldn't need =
that. But=20
in modern C runtimes,<BR>sprintf() may well be a specialization of=20
vsnprintf(), which may a <BR>need a buffer to do its =
job. Or=20
sprintf() could be implemented via an<BR>in-memory pseudo file, i.e. =
it may=20
need to construct a FILE * to pass<BR>to the underlying generic=20
routines.<BR><BR>--<BR>Hans-Bernhard Broeker ( <A=20
=
href=3D"mailto:broeker AT physik DOT rwth-aachen DOT de">broeker AT physik DOT rwth-aachend=
e</A>)<BR>Even=20
if all the snow were burnt, ashes would=20
remain.<BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_00BC_01C5B531.43ECBB20--
- Raw text -