X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "philippe meynard" Newsgroups: comp.os.msdos.djgpp Subject: Re: Pb with sprintf Date: Fri, 9 Sep 2005 11:26:04 +0200 Organization: Guest of France Telecom's news reading service Lines: 100 Message-ID: References: <2497d9a2050907160124a508c7 AT mail DOT gmail DOT com> <3oak7kF50c1lU2 AT news DOT dfncis DOT de> <3oanclF4upp5U2 AT news DOT dfncis DOT de> <2497d9a205090811344d981e1 AT mail DOT gmail DOT com> NNTP-Posting-Host: 62.161.106.155 Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00BC_01C5B531.43ECBB20" X-Trace: s1.news.oleane.net 1126257965 12071 62.161.106.155 (9 Sep 2005 09:26:05 GMT) X-Complaints-To: abuse AT oleane DOT net NNTP-Posting-Date: Fri, 9 Sep 2005 09:26:05 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com 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" 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 = wrote: Joe Wright 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
Chaf[100] is defined in = static.
"Matthew Petricone" <strstream AT gmail DOT com> a = =E9crit dans le=20 message de news: 2497d9a205090811= 344d981e1 AT mail DOT gmail DOT com...
Is=20 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.= de>=20 wrote:
Joe=20 Wright <jwright AT comcast DOT net>=20 wrote:

> What could sprintf() do with = malloc()?

Construct=20 itself a temporary buffer to work in --- the output buffer
may = not be=20 large enough.

If sprintf() were a standalone "real" function = that=20 does all the work
itself, it probably wouldn't need = that.  But=20 in modern C runtimes,
sprintf() may well be a specialization of=20 vsnprintf(), which may a
need a buffer to do its = job.  Or=20 sprintf() could be implemented via an
in-memory pseudo file, i.e. = it may=20 need to construct a FILE * to pass
to the underlying generic=20 routines.

--
Hans-Bernhard Broeker ( broeker AT physik DOT rwth-aachend= e)
Even=20 if all the snow were burnt, ashes would=20 remain.

------=_NextPart_000_00BC_01C5B531.43ECBB20--