(j3.2006) Are functions in intrinsic modules "intrinsic"?

Malcolm Cohen malcolm
Mon Nov 16 22:52:26 EST 2015


<<<
This thread started internally because a user complained that we gave an 
error for assumed-rank arguments to C_SIZEOF, pointing out that there was no 
technical reason why this function should not allow C_SIZEOF.
>>>

That's "claiming" there was no technical reason.  See below: there is one.

<<<
Should we reconsider and include C_SIZEOF in the list of places where 
assumed-rank is allowed as an actual argument?
>>>

No.

C_SIZEOF(array) is C_SIZEOF(array element) times the number of elements in 
the array.  If the assumed-rank dummy is associated with an assumed-size 
array, this is not well-defined: well, the standard defines it, but existing 
implementations with the traditional "just pass the address and forget about 
the number of elements" would find it annoying to implement - not 
impossible, but annoying, and with (possibly insignificant) increased 
overhead for every routine that used assumed-size, not just the ones using 
assumed-rank and C_SIZEOF.

Of course we could permit it with the additional requirement that the 
argument not be associated with an assumed-size array, which C_SIZEOF 
naturally excludes explicitly.  I am not sure that that really is a good 
idea though, as it is bound to fail at the most inconvenient time.

If the user actually wants the "sizeof" an element of an assumed-rank array, 
this is available via
  STORAGE_SIZE(assumed-rank-dummy)/STORAGE_SIZE(C_CHAR_'x')
indeed that formulation also works for assumed-size arrays not just 
assumed-rank!

Cheers,
-- 
.........................Malcolm.




More information about the J3 mailing list