Re: [GIT] Sparc

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Al Viro
Date: Tuesday, August 17, 2010 - 7:50 pm

On Tue, Aug 17, 2010 at 07:12:45PM -0700, David Miller wrote:

Actually, it's not that complicated:

1) base and suffices choose the possible types.
2) order of types is always the same: int -> unsigned -> long -> unsigned
long -> long long -> unsigned long long
3) we always choose the first type the value would fit into
4) L in suffix == "at least long"
5) LL in suffix == "at least long long"
6) U in suffix == "unsigned"
7) without U in suffix, base 10 == "signed"

That's it.  C90 differs from C99 only in one thing - long long (and LL) isn't
there.  The subtle mess Linus has mentioned is C90 gccism: gcc has allowed
unsigned long for decimal constants, as the last resort.  I.e. if you had
a plain decimal constant that wouldn't fit into long but would fit into
unsigned long, gcc generated a warning and treated it as unsigned long.
C90 would reject the damn thing.  _Bad_ extension, since in C99 the same
constant would be a legitimate signed long long.

But yes, "use the suffix when unsure" is a damn good idea, _especially_ since
the sizeof(long) actually varies between the targets we care about.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[GIT] Sparc, David Miller, (Tue Aug 17, 6:03 pm)
Re: [GIT] Sparc, Linus Torvalds, (Tue Aug 17, 6:31 pm)
Re: [GIT] Sparc, Linus Torvalds, (Tue Aug 17, 6:59 pm)
Re: [GIT] Sparc, David Miller, (Tue Aug 17, 7:12 pm)
Re: [GIT] Sparc, David Miller, (Tue Aug 17, 7:14 pm)
Re: [GIT] Sparc, Al Viro, (Tue Aug 17, 7:50 pm)
64-bit ppc rwsem (was: Re: [GIT] Sparc), Benjamin Herrenschmidt, (Tue Aug 17, 9:38 pm)
Re: 64-bit ppc rwsem (was: Re: [GIT] Sparc), Benjamin Herrenschmidt, (Tue Aug 17, 10:03 pm)
Re: 64-bit ppc rwsem, David Miller, (Tue Aug 17, 10:28 pm)
Re: 64-bit ppc rwsem, Sam Ravnborg, (Tue Aug 17, 10:39 pm)
Re: 64-bit ppc rwsem, David Miller, (Tue Aug 17, 10:48 pm)
Re: 64-bit ppc rwsem, Benjamin Herrenschmidt, (Wed Aug 18, 10:23 pm)
Re: 64-bit ppc rwsem, David Miller, (Wed Aug 18, 10:29 pm)
Re: 64-bit ppc rwsem, Benjamin Herrenschmidt, (Thu Aug 19, 3:24 am)
[PATCH 2/2] rwsem: Move powerpc atomic-long based implemen ..., Benjamin Herrenschmidt, (Thu Aug 19, 10:14 pm)
[PATCH 1/2] powerpc: Make rwsem use "long" type, Benjamin Herrenschmidt, (Thu Aug 19, 10:14 pm)
Re: 64-bit ppc rwsem, Arnd Bergmann, (Mon Aug 23, 6:44 am)
Re: 64-bit ppc rwsem, Benjamin Herrenschmidt, (Mon Aug 23, 3:01 pm)
Re: 64-bit ppc rwsem, David Miller, (Mon Aug 23, 3:18 pm)
Re: 64-bit ppc rwsem, Benjamin Herrenschmidt, (Mon Aug 23, 6:31 pm)
Re: [PATCH 2/2] rwsem: Move powerpc atomic-long based impl ..., Benjamin Herrenschmidt, (Mon Aug 23, 6:32 pm)
Re: 64-bit ppc rwsem, Arnd Bergmann, (Tue Aug 24, 5:06 am)