Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Function to determine the number of chars in a FILE buffer |
| Date | 2011-09-01 08:29 -0700 |
| Organization | None to speak of |
| Message-ID | <lnwrdss2lv.fsf@nuthaus.mib.org> (permalink) |
| References | <5303ab8c-2dca-4c04-bb88-49e26fc92f96@n11g2000yqh.googlegroups.com> <4E5EBC04.3060103@verizon.net> <slrnj5u9a8.35d.angel+news@pearlgates.net> <7aa0a948-3af6-40b2-8129-4d14d3f83ecb@gz5g2000vbb.googlegroups.com> <j3nohj$i6f$1@dont-email.me> |
James Kuyper <jameskuyper@verizon.net> writes:
> On 09/01/2011 03:23 AM, tm wrote:
[...]
>> Historically getc() was defined as macro.
>
> The fact that getc() is allowed to be a macro is the main purpose of
> getc(); it's otherwise redundant with fgetc(). And it could easily be a
> macro that expands into a call to fgetc().
[...]
Any standard C library function can be defined as a macro.
What's special about getc() is that, if it's defined as a macro,
it's permitted to evaluate its argument (a FILE*) more than once.
In practice, it would rarely make sense to call fgetc() or getc()
with an argument such that evaluating it more than once would
cause problems; the special permission is necessary to allow a more
efficient implementation.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Function to determine the number of chars in a FILE buffer tm <thomas.mertes@gmx.at> - 2011-08-31 15:43 -0700
Re: Function to determine the number of chars in a FILE buffer James Kuyper <jameskuyper@verizon.net> - 2011-08-31 18:56 -0400
Re: Function to determine the number of chars in a FILE buffer Angel <angel+news@spamcop.net> - 2011-09-01 06:25 +0000
Re: Function to determine the number of chars in a FILE buffer tm <thomas.mertes@gmx.at> - 2011-09-01 00:23 -0700
Re: Function to determine the number of chars in a FILE buffer Robert Wessel <robertwessel2@yahoo.com> - 2011-09-01 03:27 -0500
Re: Function to determine the number of chars in a FILE buffer James Kuyper <jameskuyper@verizon.net> - 2011-09-01 06:58 -0400
Re: Function to determine the number of chars in a FILE buffer Keith Thompson <kst-u@mib.org> - 2011-09-01 08:29 -0700
Re: Function to determine the number of chars in a FILE buffer Kenneth Brody <kenbrody@spamcop.net> - 2011-09-01 14:37 -0400
Re: Function to determine the number of chars in a FILE buffer gordonb.nfrza@burditt.org (Gordon Burditt) - 2011-09-02 21:58 -0500
Re: Function to determine the number of chars in a FILE buffer tm <thomas.mertes@gmx.at> - 2011-08-31 23:54 -0700
Re: Function to determine the number of chars in a FILE buffer Jasen Betts <jasen@xnet.co.nz> - 2011-09-01 11:02 +0000
Re: Function to determine the number of chars in a FILE buffer tm <thomas.mertes@gmx.at> - 2011-09-01 05:44 -0700
Re: Function to determine the number of chars in a FILE buffer David Schwartz <davids@webmaster.com> - 2011-09-01 04:41 -0700
Re: Function to determine the number of chars in a FILE buffer Ike Naar <ike@iceland.freeshell.org> - 2011-09-01 04:37 +0000
Re: Function to determine the number of chars in a FILE buffer Mark Storkamp <mstorkamp@yahoo.com> - 2011-09-01 08:23 -0500
csiph-web