[fpc-devel] Minor debate with ISO standard on case blocks
thaddy
thaddy at localhost
Tue Jul 30 06:38:56 CEST 2019
Telling.
I took the trouble to look up the case statement in a random selection
of about 30 instruction manuals, books and magazines about Pascal from
my personal library (only a few pretend to be ISO compliant or mention
the standard, though. These beasts are rare) and some compilers.
I can not find 1! implementation that tries to do what FPC trunk
currently does.
I am really passionate about this. The quote below seems to suggest that
the behavior in 3.0.4 was acceptable after all.
That said: the suggestion by Gareth to issue a warning at compile time
and a run-time error when an ordinal is used that has no case label
seems to be much closer to what the 7185:1990 standard actually
describes.
According to what I found there is no smoking gun: I could not find any
implementation or reference from any reputable source that implements
the case statement in the way that is implemented in trunk: compile time
error when not all of the ordinal range for the case are processed. It
simply does not exist as far as I am concerned, unless someone can
convince be by a reputable source that such implementation exists
elsewhere.
I strongly object against the current implementation and I believe it to
rely on false premises.
Thaddy
On 2019-07-30 01:43, J. Gareth Moreton wrote:
> As someone on the issue pointed out... on page 2, section 3.1:
>
> 3.1 Error
>
> A violation by a program of the requirements of this International
> Standard that a processor is permitted to leave undetected.
>
> NOTES
>
> 1. If it is possible to construct a program in which the violation or
> non-violation of this International Standard requires knowledge of the
> data read by the program or the implementation definition of
> implementation-defined features, then violation of that requirement is
> classified as an error. Processors may report on such violations of
> the requirement without such knowledge, but there always remain some
> cases that require execution, simulated execution, or proof procedures
> with the required knowledge. Requirements that can be verified without
> such knowledge are not classified as errors.
>
> 2. Processors should attempt the detection of as many errors as
> possible, and to as complete a degree as possible. Permission to omit
> detection is provided for implementations in which the detection would
> be an excessive burden.
>
> ----
More information about the fpc-devel
mailing list