[comp.lang.perl] More on castulong

nall@nu.cs.fsu.edu (John Nall) (04/06/90)

The current level of Perl (kits@18) will not make satisfactorily on
systems where Larry's Configure file determines that the C compiler
does not know how to cast negative numbers to unsigned longs, ints
and shorts.

The reason is that if the symbol CASTNEGFLOAT is undefined in config.h,
then perl.h comes up with something called castulong()  which is not
defined anywhere so far as I can determine.  CASTNEGFLOAT is not defined
if the C compiler does not perform as per paragraph 1 above.

I can work around the problem, but would just as soon see the official
version of castulong() posted.


--
John W. Nall		| Supercomputation Computations Research Institute
nall@nu.cs.fsu.edu      | Florida State University
#include <clever.h>	| Tallahassee, FL 32306

tneff@bfmny0.UU.NET (Tom Neff) (04/07/90)

In article <638@fsu.scri.fsu.edu> nall@sun8.scri.fsu.edu (John Nall) writes:
>The reason is that if the symbol CASTNEGFLOAT is undefined in config.h,
>then perl.h comes up with something called castulong()  which is not
>defined anywhere so far as I can determine.  

Strange - at the end of my copy of util.c (marked 3.0.1.5 90/03/27
16:35:13) is this:

	#ifndef CASTNEGFLOAT
	unsigned long
	castulong(f)
	double f;
	{
		long along;

		if (f >= 0.0)
		return (unsigned long)f;
		along = (long)f;
		return (unsigned long)along;
	}
	#endif

I think John had better check his whole package, possible ftp it from
scratch.

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (04/10/90)

In article <15330@bfmny0.UU.NET> tneff@bfmny0.UU.NET (Tom Neff) writes:
: In article <638@fsu.scri.fsu.edu> nall@sun8.scri.fsu.edu (John Nall) writes:
: >The reason is that if the symbol CASTNEGFLOAT is undefined in config.h,
: >then perl.h comes up with something called castulong()  which is not
: >defined anywhere so far as I can determine.  
: 
: Strange - at the end of my copy of util.c (marked 3.0.1.5 90/03/27
: 16:35:13) is this:
: 
: 	#ifndef CASTNEGFLOAT
: 	unsigned long
: 	castulong(f)
: 	double f;
: 	{
: 		long along;
: 
: 		if (f >= 0.0)
: 		return (unsigned long)f;
: 		along = (long)f;
: 		return (unsigned long)along;
: 	}
: 	#endif

Some of the early patchlevel 18 kits had a typo in util.c--it said
"catulong".  Those who upgraded via the patch won't have this problem.
If you have the problem, simply s/catulong/castulong/ in util.c and
make sure that castulong is declared as unsigned long in perl.h.

Sorry 'bout that.  In order to do quality control on my patches, I check
them out after I've generated them, and occasionally I fix something
in the patch and forget to fix it in the source.  That's what happened
this time.

Larry