From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,THIS_AD autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1cf653444208df72 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-21 23:45:24 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!151.189.0.75!newsfeed.germany.net!newsfeed2.easynews.net!easynews.net!news.cid.net!news.enyo.de!news1.enyo.de!not-for-mail From: Florian Weimer Newsgroups: comp.lang.ada Subject: Re: ada vs. cpp Date: Mon, 22 Oct 2001 09:04:24 +0200 Organization: Enyo's not your organization Message-ID: <87hess6tqf.fsf@deneb.enyo.de> References: <9q7na102nqn@drn.newsguy.com> <87k7xwa93z.fsf@deneb.enyo.de> <9cLA7.135653$3d2.4077683@bgtnsc06-news.ops.worldnet.att.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Xref: archiver1.google.com comp.lang.ada:15010 Date: 2001-10-22T09:04:24+02:00 List-Id: "David Thompson" writes: > But on a machine with 32-bit char and 32-bit (or smaller?!) int, > this promotion no longer happens, so UCHAR_MAX + 1 is > always zero, and the loop never executes. Is it always zero? I don't think so. For example, UCHAR_MAX itself could equal zero when cast to an unsigned integer type (on a ones complement machine). >> > This DSP is always funny because sizeof(int[8]) == 4. >> >> Funny indeed. Is this really legal C? > > No. sizeof(char) is defined to be 1, and sizeof any other > type must be at least 1; the common error is assuming > strictly greater. But where's this requirement in the C standard?