Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: fread/fwrite |
| Date | 2012-06-21 18:36 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <4FE3A1F2.8010201@verizon.net> (permalink) |
| References | (10 earlier) <a4f69dF7l4U7@mid.individual.net> <-9mdnR3ccJsQ7X7SnZ2dnUVZ_h2dnZ2d@bestweb.net> <a4haajF7l4U10@mid.individual.net> <4FE37D85.1070401@verizon.net> <lnvcik8gif.fsf@nuthaus.mib.org> |
On 06/21/2012 06:08 PM, Keith Thompson wrote: > 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. I was pointing out that it's a difference in the standard headers. #include <stdio.h> is permitted in both languages, but the #definition of NULL that results from that #inclusion can be a very weird animal, from a C point of view, if you're using C++ to compile it. I believe that the main point of defining nullptr was to allow #define NULL nullptr I wasn't addressing the specific issue of fread/fwrite, but the more general issue of whether it's a good idea to rely upon a C++ source for information about the C standard library. There are differences; there aren't many, and they aren't major, but they do exist.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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