On Tue, 14 Sep 1999 02:58:32 -0400, you wrote:
>I recently wrote a small library in Fortran 90 that uses
>handy features such as OPTIONAL arguments, etc. My
>buddies who write C or C++ freaked out saying they
>cannot handle this kind of fortran.
I am not surprised. This is compiler specific and you really need to
look at the assembly output to see what your compiler is doing.
For those of you that are interested, this is how we (Salford
Software) achieve this with FTN95:
OPTIONAL arguments are represented in one of three ways
1. A pointer to the variable if present.
2. 0 (Long) if the argument is NULL.
3. 0xf0f0f0f0 if the argument is missing.
In your C code you would declare a function that contains the maximum
number of arguments. Each of the optional arguments would be declared
as a long int. You would then check the value of the long int against
the above and the rest, as they say, is left as an exercise for the
reader.
Hope this helps.
--
Mark Stevens Salford Software Ltd
Adelphi House, Adelphi Street, Salford, M3 6EN, UK
Tel: +44 (0) 161 834 2454 Fax: +44 161 834 2148
Web: www.salford.co.uk email: [log in to unmask]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|