Re: BUG_ON with sizeof and bit operations

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

 



On Tue, Mar 10, 2009 at 3:59 AM, Stoyan Gaydarov <stoyboyker@xxxxxxxxx> wrote:
> I know that function calls should not normally be inside the BUG_ON
> params but what about sizeof?
>
> so would something like this work as intended:
>
> BUG_ON(expect != sizeof(foo));

IIRC sizeof is not actually a function. Its value is known by the compiler.

> also what about bit operations? so like BUG_ON(s & 3); would that
> still be ok since it doesn't actually modify the original value?

Right. I think the idea is not to have side effects.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux