On 2015-11-30 at 06:15 "'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).
As far as error vs panic goes, if it's a kernel bug, then please use panic. It's heavy-weight, but it's something that must be fixed. I'm not a fan of trying to continue after something has gone wrong, since we could trigger more permanent damage. > 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. Yep, that's why. > 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). In general, we follow that rule too. Most macros are uppercase. Some aren't where the macro is a wrapper of some sort. For example, some functions like printx and printk are macros, but the intended interface is to be a function; there's no "thread carefully" warning needed. I don't know if assert() requires the level of warning associated with macros, esp considering that assert() already exists and all of our existing code treats asserts and warns in lowercase. It's not like someone is going to get confused by the lack of uppercase. Barret -- 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.
