Re: PATCH: stdint constants

From: H. Peter Anvin
Date: Thu Nov 04 2004 - 13:02:23 EST


Followup to: <OF1C112AC2.560EA5F6-ONC1256F41.0049C0DE@xxxxxxxxxxxxx>
By author: roman.fietze@xxxxxxxxxxxxx
In newsgroup: linux.dev.kernel
>
> Hello,
>
> First of all: sorry for using Notes MUA, but cannot route to kernel.org
> due to NJABL.
>
> Allthough many books recommend using the types uint8_t to uint64_t as
> well as their signed counterparts, I could not find the MIX/MAX values
> for those types in any kernel include file.
>
> Tested on a 2.4 ARM/PPC/I386 kernel with gcc 3.0.4/3.2.2/3.3.2. Not
> tested on any 64 bit architecture.
>
> Any comments to this patch?
>

Yes. Long long is a ISO C99 type guaranteed to be at least 64 bits.
Thus,

#if defined(__GNUC__) && !defined(__STRICT_ANSI__)

is wrong; it's in fact actively harmful.

Furthermore, this should only be used by the kernel, since this comes
from <stdint.h> in userspace.

<stdint.h> really should be a compiler-provided header file. Sigh.

-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/