www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/13/14:47:12

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: Charles Sandmann <sandmann AT clio DOT rice DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Malloc/free DJGPP code
Date: Wed, 13 Feb 2002 13:16:15 CST
Organization: Rice University, Houston TX
Lines: 20
Message-ID: <3c6abb7f.sandmann@clio.rice.edu>
References: <3C6AAB24 DOT 48974C81 AT yahoo DOT com>
NNTP-Posting-Host: clio.rice.edu
X-Trace: joe.rice.edu 1013628239 10785 128.42.105.3 (13 Feb 2002 19:23:59 GMT)
X-Complaints-To: abuse AT rice DOT edu
NNTP-Posting-Date: 13 Feb 2002 19:23:59 GMT
X-NewsEditor: ED-1.5.9
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> > > really want to do this, call setbuf(stdout,0) at the beginning of your
> > > program (stderr too) to avoid the need for a buffer.
> > 
> > And if unbuffered I/O is too slow, call setvbuf with a suitable buffer
> > instead.  That should avoid the need to call malloc the first time printf
> > is called.
> 
> Nope, that didn't do it.

Won't work since startup code (before call to main) calls malloc (creating
the environment)

> Seems pointless testing setvbuf return if printf blows it up. 
> Next suggestion?

Don't call printf in malloc, or Modify all printfs in malloc to only
print on a global flag which you enable after the setbuf.  (yes, I've
hit this mis-feature before, but I replaced the printfs with direct
screen writes after format since I had a compatible module).

- Raw text -


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