On Wed, 2 Jan 2019 12:05:17 +0100 (CET) Michael Van Canneyt <mich...@freepascal.org> wrote:
> On Wed, 2 Jan 2019, Sven Barth via fpc-devel wrote: > > > Am Mi., 2. Jan. 2019, 11:08 hat Bart <bartjun...@gmail.com> > > geschrieben: > >> On Wed, Jan 2, 2019 at 9:44 AM Martok <list...@martoks-place.de> > >> wrote: > >>> - If a case statement on an ordinal does not contain labels for > >>> all > >> values of > >>> the ordinal, and no else statement is given, raise a new warning > >> (W6059). This > >>> is actually defined as an error in ISO7185 and a > >>> dynamic-violation in > >> IEC10206. > >> > >> So now I will have to add a useless else statement for every case > >> statement that uses e.g. integers, or rewrite them to > >> if..then..else or if value in [...]? > >> And how will I mage this when my code runs on different > >> architecture where the full range of the ordinal may differ? > >> > >> Please no (to this part of the proposal). > >> > > > > Warnings can always be disabled by {$warn NR off} or - I believe - a > > command line switch. > > One could also decide to have it be a default off warning for the > > non ISO modes (FPC, Delphi, MacPas) like some of the string > > conversion warnings. > > I would strongly advise to have it off by default for all but the ISO > modes. > > You have perfectly valid code today (see the example of indexed > properties) which would start generating exceptions, and you should > not be forced to add a {$ } directive or an "else" clause to a case > statement for this. I do hope you meant warnings, not exceptions. > I agree this warning is very useful for enumerated types, but really > not for integers. There are too many cases where it would be a false > positive. I have a lot of code with enums, where these warnings will force me to do a lot of changes. Mattias _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel