www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/05/11:15:07

Date: Sun, 5 Oct 1997 17:08:24 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Wolfgang DOT Glunz AT mchp DOT siemens DOT de
cc: djgpp AT delorie DOT com
Subject: Re: bug in tempnam ?
In-Reply-To: <60u01c$dl9$1@salomon.mchp.siemens.de>
Message-ID: <Pine.SUN.3.91.971005170802.19782P-100000@is>
MIME-Version: 1.0

On 1 Oct 1997, Wolfgang Glunz wrote:

> Together we found out that there might be a bug in the c-library
> function tempnam (not tmpnam !).  Under all other systems I known,
> tempnam returns a pointer to newly allocated memory if the first
> parameter is 0. Under djgpp 2.01 it looks like that tempnam behaves
> the same as tmpnam which returns a pointer to a static memory which
> is overwritten after each call to tmpnam.

DJGPP's `tempnam' just calls `tmpnam' internally, so it indeed returns
a pointer to a static buffer.

However, AFAIK, `tempnam' is non-ANSI and non-POSIX, so no official
standard exists for its behavior.  Would you care to tell which
``other systems'' have `tempname' which returns a pointer to malloc'ed
storage?

- Raw text -


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