Print

Print


Hi,

On Mon, 19 Jun 2000, Toon Moene wrote:

> Malcolm Cohen wrote:
> 
> > NAGWare f90/f95 supports LOGICAL(KIND=1) and INTEGER(KIND=1) as single-byte
> > values on all hardware platforms.
> 
> [ This is not meant to hassle Malcolm ]
> 
> I've seen several mails like this pass the mailing list now.  Does
> anyone have an idea how to portably ask for LOGICAL(KIND=1), i.e.
> without using an explicit KIND number.
> 
> Yes, I know it's non-Standard - but if more than one compiler supports
> it, it would be nice if there were a portable way to ask for the
> feature.

Yup, but there is none.

On comp.lang.fortran, I suggested the following definition of
SELECTED_LOGICAL_KIND. 

Since the range of a logical is always {T,F}, there is no need
to provide a range in the arg list.  Therefore I'd specify it
as follows.

	SELECTED_LOGICAL_KIND( [MOLD] )

without the optional MOLD argument, SELECTED_LOGICAL_KIND returns
the smallest logical that can hold the (implicit) range.

With MOLD, SELECTED_LOGICAL_KIND returns the KIND of a logical
that is the same size as MOLD, if there is one, or a negative value,
if there is not.

Since a default-KIND INTEGER is the same size as a default-KIND
LOGICAL, the following would return default LOGICAL KIND;

	INTEGER KLOG, I
	KLOG = SELECTED_LOGICAL_KIND( I )

This still wouldn't allow for selecting a LOGICAL KIND that was
not the smallest available, but was different in size from any 
other type.  Still, that might not arise, and I believe this
proposal is pretty good, overall.


	-P.

--
** Whether the playing field is level depends on the coordinate system. ***
********* Peter S. Shenkin; Schrodinger, Inc.; (201)433-2014 x111 *********
*********** [log in to unmask]; http://www.schrodinger.com ***********



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%