Hi Stoyan/Nelson, >> BUG_ON(expect != sizeof(foo)); > IIRC sizeof is not actually a function. Its value is known by the compiler. Correct - sizeof is simply a compile time operator. Its value is constant (iow hardcoded) at runtime. >> 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. Indeed. With macros you always have to watch out for expressions that are evaluated more than once. ISO is very specific about expected behaviour in some areas, and "fuzzy" in other areas. However, BUG_ON is defined as such : #define BUG_ON(condition) do { if (condition) ; } while(0) This is a safe implementation, so your bit operations should work fine. PS, a tip : If you come across lib "functions" that are default macro implemented and you want to force an actual function call (when they misbehave), enclose the call in parentheses, this forces the compiler to use the actual function call. HTH Best Regards, Kris -----Original Message----- From: kernelnewbies-bounce@xxxxxxxxxxxx [mailto:kernelnewbies-bounce@xxxxxxxxxxxx] On Behalf Of Nelson Castillo Sent: Tuesday, 10 March 2009 7:04 AM To: Stoyan Gaydarov Cc: Kernel Newbies Subject: Re: BUG_ON with sizeof and bit operations -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ