[Swan-dev] ROOF changes in commit 91a1e8537

Andrew Cagney andrew.cagney at gmail.com
Mon Mar 13 15:11:59 UTC 2017


On 13 March 2017 at 10:22, D. Hugh Redelmeier <hugh at mimosa.com> wrote:
> Another slight annoyance: some C compilers will warn you about switch
> statements that don't have a case for each enum value.  Clearly you don't
> want a "case ..._ROOF:".  Adding a "default:" would shut it up.  This did
> not come up with the commit.

I've been trying to follow the convention of using:
    #define XXX_ROOF (LAST+1)
to avoid just this hack.

Additionally, while we've enabled -Wswitch (from -Wall), there are
also the more strict -Wswitch-enum and -Wswitch-default lurking in the
wings (I say lurking as there seems to be a general trend of enum
warnings becoming more strict and we might as well adopt coding styles
that don't preclude them).

Andrew


More information about the Swan-dev mailing list