A Universal Random Number Generator.

Chip Salzenberg chip at ateng.ateng.com
Thu Mar 2 07:07:20 AEST 1989


According to mark at jhereg.Jhereg.MN.ORG (Mark H. Colburn):
>The XENIX compiler, which is a descendant of a Microsoft compiler (I think),
>[does not automatically consider large constants to be long].  It has been
>a problem in PAX, and some other code, where I had to explicitly cast
>the constant 1024 to to a long, so that the compiler wouldn't puke.

Although it's true that the Xenix compiler does not promote the constant
1024 to long, that's not the issue.  The issue is whether a *constant* too
large for an int is automatically considered a long.  The Microsoft
compiler, whatever its foibles, does handle long constants correctly.  It
also gives a warning when it does so, which is a nice feature in my
estimation.

For the curious:  The bug in the pax source was the calculation of "1024 *
1024", which should have been coded as "1024L * 1024L".

-- 
Chip Salzenberg             <chip at ateng.com> or <uunet!ateng!chip>
A T Engineering             Me?  Speak for my company?  Surely you jest!
	  "It's no good.  They're tapping the lines."



More information about the Comp.lang.c mailing list