sizeof intrinsic

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Mon May 7 18:53:00 GMT 2007


Satish Balay wrote:
> Not sure if sizeof() is part of f95 standard.. However a bunch of
> compilers except gfortran appear to support it.
> 
> Will this be supported by gfortran?

Here's a quick and dirty patch that implements sizeof.  It doesn't 
handle arrays, as I'm not sure what the expected result for allocatable 
of pointer arrays as arguments (or expressions in general) is.  From 
what I gathered by googling around, sizeof can always be evaluated at 
compile-time.  But then it couldn't accept as argument expressions whose 
size is only determined at runtime.

Can somebody with access to the Intel compiler try this, and report the 
results, or whether it gives a compile-time error:

integer, target :: i(5)
integer, pointer :: p(:)

j = 2
p=>i(2:4)
print *, sizeof (p), sizeof(i), sizeof(i(j:2*j))
end

Cheers,
- Tobi
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sizeof.diff.txt
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070507/2033bd66/attachment.txt>


More information about the Fortran mailing list