Re: [PATCH 1/2] Add C99-style constructor macros for specific-sized integers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Although it is fully legal and correct C to write something like:

	 (u64)0x123456789abcdef

.. gcc will issue a warning on 32-bit systems that 0x123456789abcdef
is too big for an "int", and that it has been transparently promoted,
even though it is obvious that that is what the user intended in the
first place.

[It says it is too big for 'long', actually].

That's because this is not valid ISO C90.  GCC tries to help you out
by using the C99 rules (it has to do something, and terminating with
an error would be a bit rude).  Perhaps the kernel should use C99
mode (-std=gnu99, to get the GNU C extensions).

+#define S8_C(x)	 x
+#define U8_C(x)  x ## U
+#define S16_C(x) x
+#define U16_C(x) x ## U
+#define S32_C(x) x
+#define U32_C(x) x ## U

These are unnecessary, Linux requires an int to be at least 32 bits.

+#define S64_C(x) x ## LL
+#define U64_C(x) x ## ULL

Here you can use LL resp. ULL on all archs.


Do these new macros really buy anything over just writing LL in the
few places that 64-bit constants are used?


Segher

--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux