[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: linux/kernel.h (&_x == &_y); why
>>>>> "Jan" == Jan Hudec <bulb@ucw.cz> writes:
Jan> On Tue, Dec 02, 2003 at 15:12:52 -0800, John Tyner wrote:
>> I believe that it is so that gcc will throw a warning if the two types
>> are not compatible.
Jan> Actualy, it should throw a warning if they are not exactly the same,
Jan> because if they are not, the comparsion breaks aliasing rules.
Jan> Especially it should throw a warning if one is signed and the other is
Jan> not.
Aliasing rules are NOT like this. See below:
[#7] An object shall have its stored value accessed only by an lvalue
expression that has one of the following types:73)
-- a type compatible with the effective type of the object,
-- a qualified version of a type compatible with the effective type
of the object,
-- a type that is the signed or unsigned type corresponding to the
effective type of the object,
-- a type that is the signed or unsigned type corresponding to a
qualified version of the effective type of the object,
-- an aggregate or union type that includes one of the
aforementioned types among its members (including, recursively, a
member of a subaggregate or contained union), or
-- a character type.
~velco
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/