From 8280225027994970232
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,d93488bb970aa444
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-06-19 11:26:00 PST
Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!195.54.122.107!newsfeed1.bredband.com!bredband!diablo.netcom.net.uk!netcom.net.uk!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: Matvei Brodski <mbrodski@bear.com>
Newsgroups: comp.std.c++
Subject: Re: How to test for NaNs and infinites?
Date: Tue, 19 Jun 2001 18:25:25 GMT
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <3B2F9717.D5017BD6@bear.com>
References: <3B176D2F.70C3E7F7@meteo.fr> <usrihtkqfjd9qfj2bgtbp6pj530asi567k@4ax.com> <b172eb2f.0106071330.5f984936@posting.google.com> <9fql8h$pfg$1@news.hal-pc.org> <3B21100E.5B25F7AA@acm.org> <9frdlp$14bc$1@news.hal-pc.org> <fl3d9ail4o.fsf@sel.cmla.ens-cachan.fr> <9g2em7$1pkk$1@news.hal-pc.org> <fl7kyi5769.fsf@jambon.cmla.ens-cachan.fr> <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> <flbsnlzpf6.fsf@jambon.cmla.ens-cachan.fr> <9gnjf5$1q76$1@news.hal-pc.org> <fld78073zj.fsf@jambon.cmla.ens-cachan.fr>
X-Trace: mail2news.demon.co.uk 992975132 mail2news:8108 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)
X-Accept-Language: en,ru
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Date: Tue, 19 Jun 2001 14:17:01 EDT
Lines: 45
Xref: archiver1.google.com comp.std.c++:6204

Gabriel Dos Reis wrote:

> "Greg Brewer" <nospam.greg@brewer.net> writes:
>
> | "Gabriel Dos Reis" <dosreis@cmla.ens-cachan.fr> wrote in message
> | news:flbsnlzpf6.fsf@jambon.cmla.ens-cachan.fr...
> | > |   struct X
> | > |   {
> | > |       int length;               // 2 byte length of name
> | > |       char name[254];    // name
> | > |    };
> | > |
> | > | When compiled with my 32 bit compiler, length will be 4 bytes long.
> | Thus,
> | > | the structure is in error.
> | > Really?  Where do you think the error lies in `struct X' definition?
> |
> | Where I indicated!  See "// 2 byte length of name" and "length will be 4
> | bytes long"
>
> That comment on itself doesn't constitue an error according to C++
> definition for the simple reason it is ignored.

To be precise (and correct me if I am wrong): Greg expects an int to be
2 bytes long. He thinks that the fact that name's offset is 4 bytes
implies that size of length is 4 bytes.
His conclusion: there is an error (somewhere).

Now, if there were an error, we would have to assume that this struct
should have been organized differently. In some true, correct way. That
is the point of Gabriel's question: what do you think that correct way
would be? I.e., should the name's offset be 2? Must sizeof(int) be 2 when
we work with 32-bit compiler?

We have duly noted *where* the perceived error is.
Could you tell us *what* is that error?

Matvei.

---
[ 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                ]



