-ff2c question: Complex type in procedure calls (related to PR 30887 / %VAL())
Tobias Schlüter
tobias.schlueter@physik.uni-muenchen.de
Thu Feb 22 20:59:00 GMT 2007
Brooks Moses wrote:
> Tobias SchlÃŒter wrote:
>> Tobias Burnus wrote:
>>> In the test case, I have:
>>> external c_to_c8
>>> complex(8) u8, v8, w8, c_to_c8
>>
>> No, you have not :-) You wrote complex*8, which gets the following
>> special treatment in gfc_match_old_kind_spec:
>>
>> /* Massage the kind numbers for complex types. */
>> if (ts->type == BT_COMPLEX)
>> {
>> if (ts->kind % 2)
>> {
>> gfc_error ("Old-style type declaration %s*%d not supported at %C",
>> gfc_basic_typename (ts->type), original_kind);
>> return MATCH_ERROR;
>> }
>> ts->kind /= 2;
>> }
>
> Wow, that's an ugly syntax hack. We don't have that one documented, do we?
>
> Honestly, I think that's counterintuitive enough that it ought to get a
> warning at anything less than -std=legacy, besides being documented, but
> maybe that's just me.
It's completely intuitive :-) a variable defined in the legacy "type*n
x" syntax, is a variable of type "type" with a storage size of "n"
bytes. People using complex*n instead of complex(n) deserve to be
punished. This includes Tobias B. Just kidding.
I agree that this should be documented. I'm not so sure about a
warning. The syntax is widely used.
- Tobi
More information about the Fortran
mailing list