From -2411033051320865633 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,d93488bb970aa444 X-Google-Attributes: gidf78e5,public X-Google-ArrivalTime: 2001-06-18 17:13:01 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!212.74.64.35!colt.net!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail From: Pete Becker Newsgroups: comp.std.c++ Subject: Re: How to test for NaNs and infinites? Date: Tue, 19 Jun 2001 00:12:19 GMT Organization: Dinkumware, Ltd Approved: Fergus Henderson , moderator of comp.std.c++ Message-ID: <3B2E97A0.652CDA4D@acm.org> References: <3B176D2F.70C3E7F7@meteo.fr> <9fql8h$pfg$1@news.hal-pc.org> <3B21100E.5B25F7AA@acm.org> <9frdlp$14bc$1@news.hal-pc.org> <9g2em7$1pkk$1@news.hal-pc.org> <9g7q93$1lu1$1@news.hal-pc.org> <3B278187.9E196C80@acm.org> <9g8a84$1uah$1@news.hal-pc.org> <3B28B104.807ED9AC@acm.org> <9gdpcm$267r$1@news.hal-pc.org> <3B2B5F7B.944B6BB1@acm.org> <9gkrvp$2uai$1@news.hal-pc.org> X-Trace: mail2news.demon.co.uk 992909546 mail2news:24930 mail2news mail2news.demon.co.uk X-Complaints-To: abuse@demon.net X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Date: 19 Jun 2001 00:07:18 GMT X-Accept-Language: en Lines: 36 Xref: archiver1.google.com comp.std.c++:6192 Greg Brewer wrote: > > "Pete Becker" wrote in message > news:3B2B5F7B.944B6BB1@acm.org... > > > struct X > > > { > > > int length; // 2 byte length of name > > > char name[254]; // name > > > }; > > The fact that the code has a comment that's wrong does not make the code > > in any way erroneous or illegal. If you believe that you can write > > conforming code that uses this struct and assumes that length is 2 bytes > > wrong you should post that code, because that's where the problem lies, > > not here. > > X x; > fread(&x, 1, sizeof(X), inFile); // or is it sizeof(X),1 -- I forget > > Your challenge was erroneous vs. illegal. The code snip is legal but > erroneous. It is erroneous because the datastream only supplies 2 bytes for > the length. In that case its behavior is undefined, since it must have been written by code compiled with a different compiler. Thus the code is erroneous, and illegal. -- Pete Becker Dinkumware, Ltd. (http://www.dinkumware.com) --- [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.research.att.com/~austern/csc/faq.html ]