delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/25/04:16:25

Date: Thu, 25 Mar 1999 10:02:05 +0100 (MET)
From: Wojciech Piechowski <voyt AT ds2 DOT pg DOT gda DOT pl>
To: djgpp AT delorie DOT com
Subject: Re: Preprocessor hates sizeof
In-Reply-To: <003a01be7635$9d68fc00$b15d44ce@computer>
Message-ID: <Pine.GSO.3.96.990325095712.28097B-100000@delta.ds2.pg.gda.pl>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 24 Mar 1999, Sean Middleditch wrote:

> What exactly is the purpose of this?  It looks to me like you're trying to
> check if the compile is 32-bit (and thus a 32-bit long int would be the same
> as the standard 32-bit int).  Instead, you should check for the definition
> of __DJGPP__, if that's what you're aiming to do.
> >
> >I wonder why the following line does not compile and how to make it work:
> >
> >#if sizeof(long int)==sizeof(int)

I need something like that in a portable program to check if the structure
is not larger than a single allocation unit. The exact code is this:

#if (sizeof(Box) > BOXGRAIN)
#error Size of Box header cannot exceed size of grain.
#endif

Now I know that GCC does and will not support this, so how can I replace
it?

--------------------\  Wojciech  Piechowski  /----------------------------
Student informatyki  \  voyt AT ds2 DOT pg DOT gda DOT pl  /  Student of computer science
Politechnika Gdanska  \____________________/   Gdansk Technical University

- Raw text -


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