From: Erik Andersen <andersen@codepoet.org>
To: "Herbert Pötzl" <herbert@13thfloor.at>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [OT] sizeof C types ...
Date: Mon, 25 Aug 2003 16:37:12 -0600 [thread overview]
Message-ID: <20030825223711.GA7809@codepoet.org> (raw)
In-Reply-To: <20030825193837.GB28525@www.13thfloor.at>
On Mon Aug 25, 2003 at 09:38:37PM +0200, Herbert Pötzl wrote:
> thanks, almost figured that, but I'm looking for
> a tabular info where the different architectures
> are present like the folowing:
>
> i386 | ia64 | alpha | sparc | wossname ...
> -----------+-------+------+-------+-------+-------------------
> char | 8 | | | |
> short | 16 | | | |
> int | 32 | | | |
> long | 32 | | | |
> long long | 64 | | | |
If one cares about the exact number of bits, IMHO one should be
using stdint.h, as defined by ISO-IEC-9899-1999 (C99), section
7.18 Integer types.
Using type such as int8_t, int16_t, int32_t, int64_t, and
uint8_t, uint16_t, uint32_t, uint64_t are the One True Way of
reliably, portably, getting the number of bits you want. It
would be very nice if the kernel were converted to use these
types as well. It would also be nice if every architecture
properly supported C99. Unfortunately, that is not true on
either count. For example, if you want your code to interoperate
with windoz, you will want to do something such as....
#if defined(_WIN32) || defined(__WIN32__)
# define uint8_t unsigned __int8
# define uint16_t unsigned __int16
# define uint32_t unsigned __int32
# define uint64_t unsigned __int64
# define int8_t __int8
# define int16_t __int16
# define int32_t __int32
# define int64_t __int64
#else
# include <stdint.h>
#endif
-Erik
--
Erik B. Andersen http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--
next prev parent reply other threads:[~2003-08-25 22:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-25 19:13 Herbert Pötzl
2003-08-25 19:27 ` Christoph Hellwig
2003-08-25 19:38 ` Herbert Pötzl
2003-08-25 22:37 ` Erik Andersen [this message]
2003-08-25 21:19 ` J.A. Magallon
2003-08-25 22:09 ` Zwane Mwaikambo
2003-08-26 7:30 ` Christoph Hellwig
2003-08-25 19:29 ` Randy.Dunlap
2003-08-25 19:41 ` Herbert Pötzl
2003-08-25 19:44 ` Christoph Hellwig
2003-08-25 19:56 ` Herbert Pötzl
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=20030825223711.GA7809@codepoet.org \
--to=andersen@codepoet.org \
--cc=herbert@13thfloor.at \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®