delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/15/10:53:21

Message-Id: <199707151448.KAA25606@delorie.com>
From: "Finn Kettner, Post Danmark" <fik DOT inc AT post DOT dk>
To: djgpp AT delorie DOT com
Subject: Re: Help with errors
Date: Tue, 15 Jul 1997 16:48:00 +0200
MIME-Version: 1.0

Hello Eric.

> 	Hmm?  32 bit ints are different?  That might be the problem.
> I used GDB and got an 8 digit or so number, and I was wondering how
> that could fit in an int.  I always thought an int was 2 bytes on any
> compiler.  Is a char still one byte?  What are the other types?  Maybe
> I should go look them up.  Thanks for the help.

Well, as far as I remember (AFAIR?? :-), the specification of the type
sizes are this:

sizeof(char) <= sizeof(short int) <= sizeof(int) <= sizeof(long int)

The ANSI C-standard (there hasen't been made an official ANSI C++
standard yet - has there??) says nothing about the sizes of the
datatypes, only which ones are equal to or bigger (or in other words -
definately not smaller) than the others.

The actual sizes are implementation dependant, only the size relations
between the types a settled. This means that you could actually run your
head against a compiler which uses 96 bit chars :-), and it could as
well be ANSI C compliant as long as the other size relations still holds
(and any other things defined in the standard of course :-).

Yours faithfully.
Finn Kettner.
PS. This comes from the top of my head, and as such is more than very
likely to include a lot of errors :-).
 

- Raw text -


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