Mail Archives: djgpp-workers/2003/11/11/17:20:52
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 -