mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthias Andree <matthias.andree@gmx.de>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: C99 types VS Linus types
Date: Mon, 7 Jul 2003 03:59:28 +0200	[thread overview]
Message-ID: <20030707015928.GC1006@merlin.emma.line.org> (raw)
In-Reply-To: <1057529906.749.41.camel@cube>

On Sun, 06 Jul 2003, Albert Cahalan wrote:

> Sure, both are "correct", but there would be a lot less
> pain and suffering in the world if "unsigned long long"
> would be used for 64-bit.

What if unsigned long long is 96 bit? or 128?

> It ought to be at least 40 years
> before 128-bit types begin to matter.

Yup, and 8-Bit CPU and 640 kB RAM ought to be enough for...

nevermind.

> In the Linux world,
> we can consider "long long" to be 64-bit, "int" to be
> 32-bit, and "long" to be the same size as a pointer.

> Then we can ditch the nasty casts:
> sprintf(foo, "%llu", (unsigned long long)bar);

Speaking of shifting forward to standards:

unsigned char foo = 42;
char bar[42];
sprintf(bar, "%ju", (uintmax_t)foo); // see IEEE Std 1003.1-2001

If that's too ugly, write your own [u]intmax_t-to-char[] converter, then
only the stack is nasty if uintmax_t is 128 bits wide and you're
printing an array uint8_t. :-P

-- 
Matthias Andree

  reply	other threads:[~2003-07-07  1:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-06 22:18 Albert Cahalan
2003-07-07  1:59 ` Matthias Andree [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-07-07 12:01 Albert Cahalan
2003-07-07 12:22 ` Matthias Andree
2003-07-07 12:24 ` Alan Cox
2003-07-06  5:03 Bernardo Innocenti
2003-07-06 12:23 ` Philippe Elie

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=20030707015928.GC1006@merlin.emma.line.org \
    --to=matthias.andree@gmx.de \
    --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®