delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/09/08/08:00:25

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Pb with sprintf
Date: 8 Sep 2005 11:59:17 GMT
Lines: 17
Message-ID: <3oanclF4upp5U2@news.dfncis.de>
References: <dfmqgu$mfs$1 AT s1 DOT news DOT oleane DOT net> <gL-dnSZBgocSw4LeRVn-uQ AT comcast DOT com> <2497d9a2050907160124a508c7 AT mail DOT gmail DOT com> <dfp3ue$2tk$1 AT s1 DOT news DOT oleane DOT net> <3oak7kF50c1lU2 AT news DOT dfncis DOT de> <fKGdnQEh9rf6gb3eRVn-rQ AT comcast DOT com>
X-Trace: news.dfncis.de 4cXTvtUKNqhUwECJd+3lXQu6vJgUitkq55eXPmVQJCP5+uUhkFPO7u9W76
X-Orig-Path: not-for-mail
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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.  

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.

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019