Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #22505

Re: fread/fwrite

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: fread/fwrite
Date 2012-06-21 15:08 -0700
Organization None to speak of
Message-ID <lnvcik8gif.fsf@nuthaus.mib.org> (permalink)
References (9 earlier) <41c3a10f-4e64-4d58-a4d8-7e653a739d7e@l17g2000vbj.googlegroups.com> <a4f69dF7l4U7@mid.individual.net> <-9mdnR3ccJsQ7X7SnZ2dnUVZ_h2dnZ2d@bestweb.net> <a4haajF7l4U10@mid.individual.net> <4FE37D85.1070401@verizon.net>

Show all headers | View raw


James Kuyper <jameskuyper@verizon.net> writes:
[...]
> Section 2 of annex C of the C++ standard has 3 1/2 pages listing the
> ways in which the C++ version of the C standard library differs from the
> C version. Unless you're familiar with precisely what those differences
> are, you shouldn't assume that information about the C++ version will be
> valid for the C version. Since only C/C++ experts are likely to have
> that information, it's generally not a good idea for a newbie to go to
> the wrong place for such information.
>
> The only difference that matters for stdio.h is that NULL is a required
> to be a C++ null pointer constant, rather than a C null pointer
> constant. The simplest consequence is that NULL cannot expand to an
> expression with type void*. The other consequence is that NULL can
> expand to any one of several types of things that would not qualify as
> integer constant expressions in C, such as:
>
> 1. An expression referring to a non-volatile const-qualified object of
> integral or enumeration type, initialized with a integer constant
> expression.
> 2. A value of type std::nullptr_t, such as nullptr.
> 3. A call to a constexpr function or constructor.
[...]

I wouldn't call that a difference in the library functions; rather
it's a difference in the languages, specifically in how they express
null pointer constants. The behavior of fread() and fwrite() when
given a null pointer as an argument is the same in both languages --
or, rather, it's undefined in both languages.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
    Will write code for food.
"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


Thread

fread/fwrite "billcun@nspam.invalid" <billcun@suddenlink.net> - 2012-06-18 13:45 -0700
  Re: fread/fwrite Ian Collins <ian-news@hotmail.com> - 2012-06-19 09:28 +1200
  Re: fread/fwrite Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-18 17:47 -0400
    Re: fread/fwrite billcun@suddenlink.net - 2012-06-18 15:48 -0700
      Re: fread/fwrite Ike Naar <ike@iceland.freeshell.org> - 2012-06-18 23:37 +0000
      Re: fread/fwrite Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-18 21:56 -0400
    Re: fread/fwrite billcun@suddenlink.net - 2012-06-19 04:54 -0700
      Re: fread/fwrite Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-19 09:43 -0400
        Re: fread/fwrite billcun@suddenlink.net - 2012-06-19 09:51 -0700
          Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-20 00:05 -0700
            Re: fread/fwrite James Kuyper <jameskuyper@verizon.net> - 2012-06-20 06:45 -0400
              Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-20 04:20 -0700
                Re: fread/fwrite tom st denis <tom@iahu.ca> - 2012-06-20 07:54 -0700
            Re: fread/fwrite billcun@suddenlink.net - 2012-06-20 08:13 -0700
              Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-21 00:17 -0700
      Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-19 08:17 -0700
        Re: fread/fwrite Mark Bluemel <mark.bluemel@googlemail.com> - 2012-06-20 01:05 -0700
          Re: fread/fwrite billcun@suddenlink.net - 2012-06-20 08:17 -0700
            Re: fread/fwrite Johannes Bauer <dfnsonfsduifb@gmx.de> - 2012-06-20 17:33 +0200
              Re: fread/fwrite billcun@suddenlink.net - 2012-06-20 08:50 -0700
              Re: fread/fwrite James Kuyper <jameskuyper@verizon.net> - 2012-06-21 07:45 -0400
            Re: fread/fwrite Kenneth Brody <kenbrody@spamcop.net> - 2012-06-20 18:38 -0400
              Re: fread/fwrite billcun@suddenlink.net - 2012-06-20 15:59 -0700
                Re: fread/fwrite "BartC" <bc@freeuk.com> - 2012-06-21 00:24 +0100
                Re: fread/fwrite Ian Collins <ian-news@hotmail.com> - 2012-06-21 11:40 +1200
                Re: fread/fwrite Bill Cunningham <billcun@suddenlink.net> - 2012-06-20 16:47 -0700
                Re: fread/fwrite Ian Collins <ian-news@hotmail.com> - 2012-06-21 11:56 +1200
                Re: fread/fwrite Bill Cunningham <billcun@suddenlink.net> - 2012-06-20 17:11 -0700
                Re: fread/fwrite Ian Collins <ian-news@hotmail.com> - 2012-06-21 12:28 +1200
                Re: fread/fwrite Bill Cunningham <billcun@suddenlink.net> - 2012-06-20 17:51 -0700
                Re: fread/fwrite Kenneth Brody <kenbrody@spamcop.net> - 2012-06-21 15:05 -0400
                Re: fread/fwrite Ian Collins <ian-news@hotmail.com> - 2012-06-22 07:17 +1200
                Re: fread/fwrite James Kuyper <jameskuyper@verizon.net> - 2012-06-21 16:01 -0400
                Re: fread/fwrite Keith Thompson <kst-u@mib.org> - 2012-06-21 15:08 -0700
                Re: fread/fwrite James Kuyper <jameskuyper@verizon.net> - 2012-06-21 18:36 -0400
                Re: fread/fwrite Keith Thompson <kst-u@mib.org> - 2012-06-21 16:49 -0700
                Re: fread/fwrite Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-21 01:30 +0100
                Re: fread/fwrite Bill Cunningham <billcun@suddenlink.net> - 2012-06-20 17:51 -0700
                Re: fread/fwrite Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-21 02:22 +0100
                Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-22 00:13 -0700
                Re: fread/fwrite tom st denis <tom@iahu.ca> - 2012-06-21 04:22 -0700
                Re: fread/fwrite Bill Cunningham <billcun@suddenlink.net> - 2012-06-22 12:14 -0700
                Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-21 00:33 -0700
              Re: fread/fwrite Bill Cunningham <billcun@suddenlink.net> - 2012-06-20 16:27 -0700
            Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-21 00:21 -0700
              Re: fread/fwrite Mark Bluemel <mark.bluemel@googlemail.com> - 2012-06-21 07:17 -0700
                Re: fread/fwrite nick_keighley_nospam@hotmail.com - 2012-06-22 00:22 -0700
                Re: fread/fwrite Bill Cunningham <billcun@suddenlink.net> - 2012-06-22 12:17 -0700
  Re: fread/fwrite John Gordon <gordon@panix.com> - 2012-06-18 22:05 +0000
    Re: fread/fwrite billcun@suddenlink.net - 2012-06-20 09:03 -0700
      Re: fread/fwrite John Gordon <gordon@panix.com> - 2012-06-20 16:28 +0000
        Re: fread/fwrite billcun@suddenlink.net - 2012-06-20 09:53 -0700

csiph-web