[J3] Question about enum input

Van Snyder van.snyder at sbcglobal.net
Sat Mar 25 20:30:24 UTC 2023


Subclause 13.7.2.2 "Integer editing" says that if the effective item
for input is of enum type, the value assigned is the enum value
corresponding to the value of the input field.

Unlike ENUMERATION, ENUM allows to assign a numeric value to an
enumerator. The values of enumerators of ENUM type are not required to
be consecutive.

What happens if the input value is not the value of any enumerator of
the ENUM type? Does an error condition exist or is the program simply
not standard conformant? Or is a variable of ENUM type allowed to have
a numeric value that is not the numeric value of any enumerator of the
type?

For input of ENUMERATION  type, the value is required to be greater
than zero and not greater than the number of enumerators of the type.
What happens if the value is outside that range? Does an error
condition exist or is the program simply not standard conformant?

12.22.2p2 "Occurrence of input/output conditions" says that the set of
input/output error conditions is processor dependent, so it appears
that a processor is not required to detect these conditions.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20230325/d77db9c6/attachment.htm>


More information about the J3 mailing list