It's more like:
if (unlikely(!(x < y && !foo))) error(EBADMSG, "Assertion failed: x < y &&
!foo");
Which does not fit the rule of one insn per line. So it's really:
if (unlikely(!(x < y && !foo)))
error(EBADMSG, "Assertion failed: x < y && !foo");
And if you have then in ten places within a function, to check user data
conditions, it gets boring pretty quickly.
On Mon, Nov 30, 2015 at 6:29 AM, Dan Cross <[email protected]> wrote:
> We have that, it's spelled:
>
> if (x < y && !foo) error(EBADMSG);
>
> :-)
>
> On Mon, Nov 30, 2015 at 9:15 AM, 'Davide Libenzi' via Akaros <
> [email protected]> wrote:
>
>> I have found it useful, in the code I am writing, to have an assert which
>> throws an error(), instead of a panic() (which is a bit extreme).
>>
>> ERROR_ASSERT(EBADMSG, x < y && !foo);
>>
>> I am looking at the assert.h file, and all the macros there (likely to
>> follow the historical assert() naming convention) use lowercase.
>> One of the very few coding style rules I am passionate of (and which has
>> been followed pretty much by every project I worked on), is uppercase for
>> macros (a sort of "thread carefully" warning to the developer).
>> Any very good reason why it should be lowercase?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Akaros" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Akaros" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.