Re: Fortran function returning incorrect type based on function name

From: <brownrig_at_nyahnyahspammersnyahnyah>
Date: Wed Dec 04 2013 - 20:56:19 MST

Uhmmm... that was intended to be:

"ancient versions...had *implicit* typing in the absense of explicit
programmer-specified..."

:-/

  On Wed, 04 Dec 2013 20:45:27 -0700
  <brownrig@ucar.edu> wrote:
> Hi Alan,
>
> As you likely know, ancient versions of fortran (f77 and prior) had
> explicit typing in the absense of explicit programmer-specified
>types:
> any variable/function beginning with i--through--n was presumed of
> integer type, all others were considered real. I don't know what the
> deal is with more modern versions of fortran.
>
> I see that you are properly declaring the types of your functions
> *within* their definition. I'm wondering if you need to declare
>their
> types in the outer calling scope? That said, I tried a little
> experiment to test that notion and got a compiler error rather than
>a
> silent type conversion.
>
>FWIW...
> Rick
>
>
> On Wed, 4 Dec 2013 22:22:47 -0500
> Alan Brammer <abrammer@albany.edu> wrote:
>> Hi all,
>>
>> I have 2 iterations of the exact same code below.  One function
>>named “abcd" that returns a float as expected, one function named
>>“lbcd" which incorrectly returns an integer, though not even the
>>nearest integer but just zero. 
>>
>> I’ve narrowed this down to whether or not the function begins with
>>the letter l ?
>>
>> The returned xx value is correct, but the function value returned is
>>the issue. 
>>
>>
>> I imagine this is an issue with WRAPIT possibly, so below is the
>>version I have.  I’ve never noticed the below syntax error in `WRAPIT
>>-d` and wrapped routines typically work as expected. 
>>
>>  
>> WRAPIT Version: 120209
>> OPERATING SYSTEM: Linux
>> nbits = 64
>>FORTRAN COMPILER (f90c): gfortran
>>FORTRAN COMPILER OPTIONS (fopts):  -m64 -fPIC -v -c
>>-fno-second-underscore
>> A syntax error occurred while parsing: 
>> gcc -fPIC -m64 -c -I/ct12/abrammer/ncl6.1.2//include WRAPIT.c
>> SHARED OBJECT NAME (SharedObj): NONE
>> LINKER SUFFIX (ld_suffix): WRAPIT.o -o NONE
>>  
>> LINKING
>> gcc -m64 -fPIC -shared WRAPIT.o -o NONE -lgfortran
>> END WRAPIT
>>
>>
>> Thanks,
>> Alan.
>>
>>
>> p.s. The code here is trivial and getting the result is not the
>>issue. 
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Dec 4 20:56:28 2013

This archive was generated by hypermail 2.1.8 : Fri Dec 13 2013 - 11:39:30 MST