Re: pgsql: Remove useless default clause in switch

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Remove useless default clause in switch
Date: 2018-04-24 01:18:24
Message-ID: 87fu3lbe12.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

>>>>> "David" == David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> writes:

David> I always thought that when all options were covered that we
David> generally kept a default just in case someone added another enum
David> and forgot to update the code.

That's what compiler warnings (-Wswitch, included in -Wall) are for;
it's actually a _bad_ idea to have a default clause in such cases, since
it stops the compiler from warning you.

--
Andrew (irc:RhodiumToad)

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2018-04-24 01:20:42 Re: pgsql: Remove useless default clause in switch
Previous Message Tom Lane 2018-04-24 01:17:05 Re: pgsql: Remove useless default clause in switch