Re: [PATCH 7/16] Let void have sizeof 1

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

 



On Tue, Dec 23, 2008 at 08:51, Christopher Li <sparse@xxxxxxxxxxx> wrote:
>> But how about void *? If void *p = x, what p+1 should be? Gcc defines
>> sizeof(void) being 1, and people seem to know and use this.
>> http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Warning-Options.html#index-Wno_002dpointer_002darith-347
>
> Using pointer arithmetic on void* is not as crazy as using
> sizeof(void) directly. Most people using void* arithmetic is
> thinking it as char *. You should able to add a one line change
> in evaluate_ptr_add() to allow void* pointer arithmetic.
>
> Still better than hard code sizeof(void) as 1.

I don't really see the problem. It's not like you can pass
void i; or void *p; *p = 5; or store something into void anyway.
And in gcc void *p; sizeof(*p) == 1, so void realy looks like
being sizeof 1.
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux