public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joe Buck <jbuck@Synopsys.COM>
To: alex.buell@tahallah.demon.co.uk (Alex Buell)
Cc: egcs@egcs.cygnus.com
Subject: Re: `quad' printf format specifier ?
Date: Mon, 08 Feb 1999 13:57:00 -0000	[thread overview]
Message-ID: <199902082156.NAA08052@atrus.synopsys.com> (raw)
In-Reply-To: < Pine.LNX.4.05.9902081606350.164-100000@lo-pc3035a.hitc.com >; from "Alex Buell" at Feb 8, 99 4:12 pm

> On Mon, 8 Feb 1999, Jeffrey A Law wrote:
> 
> > No, you can't assume that.  You can assume:
> > 
> > sizeof (long long) >=  sizeof (long) >= sizeof (int) >= sizeof (short) >= sizeof (char)
> 
> Assuming that >= means greater *or* equal to, are you saying that given
> 'long long' is 64 bits then 'long', 'int', 'short' and 'char' can also be
> 64 bits in certain circumstances? 

Correct in theory.

> If that's correct, the expression 'Oh bugger!' is something that comes to
> mind. What's the best way to ensure that you get datatypes of a given
> bit-length in C/C++?

If some object must be a signed, 32-bit type, make a typedef int32 and
use that.  Your code won't run when someone tries to port it to a 24-bit
DSP, but that's life.

WARNING: multiple messages have this Message-ID
From: Joe Buck <jbuck@Synopsys.COM>
To: alex.buell@tahallah.demon.co.uk (Alex Buell)
Cc: egcs@egcs.cygnus.com
Subject: Re: `quad' printf format specifier ?
Date: Sun, 28 Feb 1999 22:53:00 -0000	[thread overview]
Message-ID: <199902082156.NAA08052@atrus.synopsys.com> (raw)
Message-ID: <19990228225300.x6Ipk90zEgrZvOBERtHoJM3PD-tcGrsniv4_vNGudGs@z> (raw)
In-Reply-To: <Pine.LNX.4.05.9902081606350.164-100000@lo-pc3035a.hitc.com>

> On Mon, 8 Feb 1999, Jeffrey A Law wrote:
> 
> > No, you can't assume that.  You can assume:
> > 
> > sizeof (long long) >=  sizeof (long) >= sizeof (int) >= sizeof (short) >= sizeof (char)
> 
> Assuming that >= means greater *or* equal to, are you saying that given
> 'long long' is 64 bits then 'long', 'int', 'short' and 'char' can also be
> 64 bits in certain circumstances? 

Correct in theory.

> If that's correct, the expression 'Oh bugger!' is something that comes to
> mind. What's the best way to ensure that you get datatypes of a given
> bit-length in C/C++?

If some object must be a signed, 32-bit type, make a typedef int32 and
use that.  Your code won't run when someone tries to port it to a 24-bit
DSP, but that's life.


  parent reply	other threads:[~1999-02-08 13:57 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-08  9:25 Guillermo A. Loyola
     [not found] ` < 8C36CEF2AF34D211922D00A0C9D60A54020D0F@epimail.epigram.com >
1999-02-08 11:48   ` Alex Buell
     [not found]     ` < Pine.LNX.4.05.9902081436140.307-100000@lo-pc3035a.hitc.com >
1999-02-08 12:24       ` Jeffrey A Law
     [not found]         ` < 1997.918505244@hurl.cygnus.com >
1999-02-08 13:12           ` Alex Buell
     [not found]             ` < Pine.LNX.4.05.9902081606350.164-100000@lo-pc3035a.hitc.com >
1999-02-08 13:57               ` Joe Buck [this message]
1999-02-28 22:53                 ` Joe Buck
1999-02-08 14:00               ` Jeffrey A Law
1999-02-28 22:53                 ` Jeffrey A Law
1999-02-28 22:53             ` Alex Buell
1999-02-28 22:53         ` Jeffrey A Law
1999-02-28 22:53     ` Alex Buell
1999-02-28 22:53 ` Guillermo A. Loyola
  -- strict thread matches above, loose matches on Subject: below --
1999-02-10 11:33 Kaveh R. Ghazi
1999-02-28 22:53 ` Kaveh R. Ghazi
1999-02-10  8:02 Kaveh R. Ghazi
1999-02-28 22:53 ` Kaveh R. Ghazi
1999-02-09  7:13 John Breen
     [not found] ` < 19990209150626.21275.qmail@hotmail.com >
1999-02-09  8:59   ` Alan Lehotsky
1999-02-08 15:20 Ross Smith
1999-02-28 22:53 ` Ross Smith
     [not found] <19990206133120.26761@liafa1.liafa.jussieu.fr>
1999-02-06 11:04 ` Zack Weinberg
     [not found]   ` < 199902061904.OAA02631@blastula.phys.columbia.edu >
1999-02-06 12:27     ` Alex Buell
1999-02-28 22:53       ` Alex Buell
1999-02-06 13:23     ` Marc Espie
1999-02-08  1:44       ` Andreas Schwab
1999-02-28 22:53         ` Andreas Schwab
     [not found]       ` < 19990206222305.19585@liafa1.liafa.jussieu.fr >
1999-02-08 20:51         ` Zack Weinberg
1999-02-28 22:53           ` Zack Weinberg
1999-02-28 22:53       ` Marc Espie
1999-02-28 22:53   ` Zack Weinberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199902082156.NAA08052@atrus.synopsys.com \
    --to=jbuck@synopsys.com \
    --cc=alex.buell@tahallah.demon.co.uk \
    --cc=egcs@egcs.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).