delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/11/11/17:20:52

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3FB15D6E.E3FFCC07@phekda.freeserve.co.uk>
Date: Tue, 11 Nov 2003 22:06:38 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: Suggested improvements
References: <Pine DOT OSF DOT 4 DOT 58 DOT 0311071212520 DOT 5324 AT sirppi DOT helsinki DOT fi>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Esa A E Peuha wrote:
> 
> I have been thinking of some small possible improvements to djgp's libc.
> 
> First of these is fgetc/getc and fputc/putc.  These two pairs of
> functions are completely identical, so maybe we could define fgetc to
> getc and fputc to putc in stdio.h if ANSI allows it (if not, then
> fgetc/fputc might be just stabs to getc/putc).

(I think you mean "stubs" rather than "stabs".)

fgetc and fputc are functions. I don't think they can be macros. getc and putc
can be macros.

From C99, section 7.19.7.8, paragraph 2:

"The putc function is equivalent to fputc, except that if it is implemented as
a macro, it
may evaluate stream more than once, so that argument should never be an
expression
with side effects."

If you're looking for something to do in <stdio.h>, perhaps you could look at
implementing the *_unlocked macros described in POSIX/Single Unix
Specification v3 (SUSv3). You can download SUSv3 for free at
http://www.opengroup.org/ or http://www.unix.org/ (I forget which is quicker).
 
> Second, do we ever expect close do something that _close can't do?  I'm
> asking this because now close is a stub to __close which calls _close...
> (This reminds me of the joke that every computing science problem can be
> solved by adding a layer of indirection. :-)  It seems to me that it
> would be more sensible to define close to _close in libc/stabs.h.

Is there any point changing this? What we have is equivalent to a stub.

Bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

"You can't evaluate a man by logic alone." -- McCoy, "I, Mudd", Star Trek

- Raw text -


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