m4 expert needed

Steve Kargl sgk@troutmask.apl.washington.edu
Fri Nov 11 21:47:00 GMT 2005


On Fri, Nov 11, 2005 at 10:23:06PM +0100, Thomas Koenig wrote:
> On Fri, Nov 11, 2005 at 12:04:24PM -0800, Steve Kargl wrote:
> > So who's our resident m4 expert?
> 
> I can drag up a bit about m4 :-)
> 
> > So, we have TRANSFER(SOURCE,MOLD,[SIZE]) with SIZE optional.
> > SOURCE and MOLD can be any type and scalar or array.  This
> > means we need 
> > 
> >   SOURCE: character, logical(1,2,4,8), integer(1,2,4,8),
> >           real(4,8,[10,16]), complex(4,8,[10,16])
> 
> I think we can get by with
> 
>     SOURCE: character, 1, 2, 4, 8, (16), (real10), complex4, complex8,
> 	(complex10), (complex16)
> 
> For tranfer, I don't think we need to differentiate between
> logical, integer and real of the same sizes.  So, 9 to 13 source
> and kind types.

You're probably right.  The ones that can be strange are 

  integer*2 i2
  integer*4 i4
  i2 = 42
  i4 = transfer(i2,i4)
  print *, i2, i4

kargl[215] f95 -o z t2.f90
Extension: t2.f90, line 1: Byte count on numeric data type
           detected at *@2
Extension: t2.f90, line 2: Byte count on numeric data type
           detected at *@4
[f95 continuing despite warning messages]
Warning: t2.f90, line 4: Intrinsic TRANSFER has partly undefined result
kargl[216] ./z
 42 42

f95 is NAG's compiler.  AFAIK, it is transferring 2 bytes into the
the 4 byte integer.  The other 2 bytes are undefined.

Anyway, for TRANSFER is the last Fortran 95 intrinsic that is
fubar.

-- 
Steve



More information about the Fortran mailing list