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

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

 



On Wed, Dec 24, 2008 at 3:35 PM, Tommy Thorn <tommy@xxxxxxxxxxxx> wrote:
>
> You can't have one without the other as you will break identities like
>
>  (uintptr_t) (x + k) === (uintptr_t) x + sizeof (typeof (x)) * k
>
> which could appear in a macro.

Right. That is exactly the place I actuall want to know. We should
consider fix that in the source to have proper type. I expect there is
not much place in the kernel use that.

I can write some code to find out how many place in the kernel
actually need to evaluate sizeof(void).

What do you think?

>
> I really think you should let it go. The C standard for Linux is for all
> practical purposes GCC C, not C99 C.
>
> Trying to impose a stricter standard will just make sparse a less useful
> tool.

I understand that kernel is C stander gcc. But the whole point of sparse is
stricter than gcc. Otherwise we will just use gcc instead.

I agree that we should probably let the place use void* + offset go.

It all boils down to do we care about place directly use sizeof(void) or not.

Another aspect is that, inside sparse, it become very hard to distinguish
void vs char, other than compare it is &void_ctype or not. If we decide go
with sizeof(void) == 1. Those place that assume only uncompleted ctype
will have bit_size == 0 need to be fixed as well.

Chris
--
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