public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: torvalds@transmeta.com (Linus Torvalds)
To: linux-kernel@vger.kernel.org
Subject: Re: Compiling kernel with SuSE 8.2/gcc 3.3
Date: Thu, 12 Jun 2003 02:00:06 +0000 (UTC)	[thread overview]
Message-ID: <bc8mr6$eqk$1@old-penguin.transmeta.com> (raw)
In-Reply-To: 3EE7D659.2000003@austin.rr.com

In article <3EE7D659.2000003@austin.rr.com>,
Steve French  <smfrench@austin.rr.com> wrote:
>Although it fixes it for building on 32 bit architectures, won't changing
>
>
>	__u64 uid = 0xFFFFFFFFFFFFFFFF;
>to
>
>	__u64 uid = 0xFFFFFFFFFFFFFFFFULL;
>
>generate a type mismatch warning on ppc64 and similar 64 bit
>architecutres since __u64 is not a unsigned long long on ppc64 
>(it is unsigned long)?

No, why would it? 

If you do

	char c = 1;

do you expect a warning? The right side of the assignent 
is an "int", and the left side is a "char", but it's perfectly ok to
assign a wider type to a narrower one.

And so if "__u64" were to be a plain "unsigned long" on a 64-bit
architecture (and even if "unsigned long long" were to be 128 bits), the
constant 0xFFFFFFFFFFFFFFFFULL is (a) a perfectly valid unsigned long
long value and (b) fits perfectly well even in an "unsigned long", so
the compiler has no reason to complain about the assignment losing bits
(which it otherwise might do).

So I'd much rather make the constants too big than too small. And yes,
Andrew's suggestion about just assigning -1 works, but it's actually a
very subtle cast at that point.

		Linus

  parent reply	other threads:[~2003-06-12  1:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3EE6B7A2.3000606@austin.rr.com.suse.lists.linux.kernel>
2003-06-11  8:01 ` Compiling kernel with SuSE 8.2/gcc 3.3 Andi Kleen
2003-06-12  1:24   ` Steve French
2003-06-12  1:40     ` Andrew Morton
2003-06-12  2:17       ` Riley Williams
2003-06-12  2:00     ` Linus Torvalds [this message]
2003-06-12 12:52     ` Horst von Brand
2003-06-11  5:01 Steve French
2003-06-11 11:20 ` Richard B. Johnson
2003-06-11 13:59   ` Richard B. Johnson
2003-06-11 11:28 ` Matthias Andree
2003-06-11 16:12 ` Andreas Schwab
     [not found] <20030408134240.45cdad7e.skraw@ithnet.com.suse.lists.linux.kernel>
2003-04-08 13:14 ` Andi Kleen
     [not found] <20030408115008$0cd2@gated-at.bofh.it>
2003-04-08 12:02 ` Arnd Bergmann
  -- strict thread matches above, loose matches on Subject: below --
2003-04-08 11:42 Stephan von Krawczynski

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='bc8mr6$eqk$1@old-penguin.transmeta.com' \
    --to=torvalds@transmeta.com \
    --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