sizeof intrinsic
Erik Schnetter
schnetter@cct.lsu.edu
Mon May 7 19:17:00 GMT 2007
On May 7, 2007, at 13:52:54, Tobias Schlüter wrote:
> 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
$ ifort -V
Intel(R) Fortran Compiler for 32-bit applications, Version 9.1
Build 20070112
$ ifort -o sizeof sizeof.f90
$ ./sizeof
12 20 12
-erik
--
Erik Schnetter <schnetter@cct.lsu.edu>
My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from www.keyserver.net.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070507/2d4495f3/attachment.sig>
More information about the Fortran
mailing list