Date: Mon, 24 Nov 2014 04:46:31 +0900
From: Izumi Tsutsui <[email protected]>
Christos said "it is legally converting a void * pointer."
http://mail-index.netbsd.org/source-changes-d/2014/11/16/msg007356.html
You guys have different opinions. Which is correct?
Which C99 specification you think the existing abcksum violates?
Casting to void * is valid. Converting a pointer to a uint8_t object
to uint16_t * and then dereferencing the uint16_t * is not valid, even
if you converted to uint16_t * via some void * casts.
See C99 Section 6.5 `Expressions', Clause 7, p. 68: `An object shall
have its stored value accessed only by an lvalue expression that has
one of the following types: ...'. Casts through void * are irrelevant
here: if the object's effective type is uint8_t (as is the case for an
element of the bb_xxboot member of a struct bootblock), uint16_t is
not one of the allowed types for accessing the object.