lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 3 Mar 2008 04:20:37 +0100
From:	Segher Boessenkool <segher@...nel.crashing.org>
To:	"H. Peter Anvin" <hpa@...or.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Linux Arch Mailing List <linux-arch@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	David Brownell <dbrownell@...rs.sourceforge.net>
Subject: Re: [PATCH 1/2] Add C99-style constructor macros for specific-sized integers

> 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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ