Re: Sparse parsing question: string literal

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

 



Christopher,

Do you have any comment on sparse giving warning of:
sizeof(function_name)?

The programmer usually mean sizeof(&function_name).
But 729 said sizeof is such a special case the function degenerate
into pointers does not work inside sizeof().

Should sparse give warning for sizeof(function_name) at all?

It's a question of intent.

sizeof(function_name) was written, but was
sizeof(function_name()) intended?

Of course sizeof(&function_name) may have been written, but
sizeof(&function_name()) was intended.  But that & is an
unusually thing to include in a function call, which makes it
less likely that () were accidentally omitted.

Is it reasonable to require people to add & to signal,
yes I really do mean pointer to function?  The indignity
if having to type that extra character!

I'm inclined towards generating warnings, since there is a
way of making the warning to go away, e.g., add & or ().

--
Derek M. Jones           Software analysis
tel: +44 (0)1252 520667  blog:shape-of-code.coding-guidelines.com
--
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