www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/22/07:15:27

From: buers AT gmx DOT de (Dieter Buerssner)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C++, complex, etc
Date: 22 May 2000 11:08:21 GMT
Lines: 19
Message-ID: <8gb9rj.3vs4i2t.0@buerssner-17104.user.cis.dfn.de>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000518184200 DOT 15189T-100000 AT is> <8g1l6o DOT 3vs4qnf DOT 0 AT buerssner-17104 DOT user DOT cis DOT dfn DOT de> <200005191227 DOT IAA23640 AT indy DOT delorie DOT com> <8g3o1e DOT 3vs4qnf DOT 0 AT buerssner-17104 DOT user DOT cis DOT dfn DOT de> <r4oeisonbbt3qes52cv3dtthmkjuc7de4i AT 4ax DOT com>
NNTP-Posting-Host: pec-45-56.tnt3.s2.uunet.de (149.225.45.56)
Mime-Version: 1.0
X-Trace: fu-berlin.de 958993701 998416 149.225.45.56 (16 [17104])
X-Posting-Agent: Hamster/1.3.13.0
User-Agent: Xnews/03.02.04
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Damian Yerrick wrote:

>On 19 May 2000 13:51:00 GMT, buers AT gmx DOT de (Dieter Buerssner) wrote:
>>For DJGPP (and any C90 compiler), you can write (size_t)-1 instead
>>of SIZE_MAX.
>
>DJGPP?  Yes.  Any C90 compiler?  No.  For example, the MC68000
>microprocessor represents all sizes as 32-bit integers, but the chip
>has only 24 address lines; addresses are anded with 0x00ffffff before
>being sent out the wire.  In this case, size_t would probably be
>typedef'd as unsigned long, but C99's SIZE_MAX would be 0x00ffffff not
>0xffffffff.

My reading of the Standard is different. From my understanding, when
an implementation chooses to limit size_t to 0xffffff, it must have
an unsigned integer type, that "overflows an wraps" at exactly that 
value. Any assignment from a different integer type to an unsigned 
integer type automatically must be modulus (UINTTYPE_MAX+1). Therefore 
(UINTTYPE)-1 is always UINTTYPE_MAX.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019