[Patch, Fortran, OOP] PR 49638: [OOP] length parameter is ignored when overriding type bound character functions with constant length.

Tobias Burnus burnus@net-b.de
Fri Aug 19 13:12:00 GMT 2011


On 08/19/2011 01:55 PM, Mikael Morin wrote:
> OK from my side for the code proper.
>
> I have one comment though about this:
> +/* Compare two expressions.  Return values:
> +   * +1 if e1>  e2
> +   * 0 if e1 == e2
> +   * -1 if e1<  e2
> +   * -2 if the relationship could not be determined
> +   * -3 if e1 /= e2, but we cannot tell which one is larger.  */
>
> I think this is misleading, as the function does not always return -3 when
> e1/=e2. There is for example (currently) no special handling for operators.
> Here is an attempt at expressing it:
>    * -3 in some cases where we could determine that e1 and e2 have different
> data dependencies (and thus are not guaranteed to have always the same value),
> but we cannot tell whether one is greater than the other.

Besides that issue, I am wondering whether we shouldn't start to use an 
ENUM for those. I think for "<" vs. "==" vs. ">" one can use a number 
(-1, 0, 1) and then compare the result against 0 (>0, == 0 etc.).

However, for 5 values, I think it makes sense to do something else 
otherwise, someone write "... < 0" which not only matches -1 but also -2 
or -3.

I think this does not block the committal but one should think about 
whether one should do it as follow up.

Tobias,
who has not read the patch.



More information about the Fortran mailing list