Subject: Re: Generic LP64 define?
To: Chris G. Demetriou <cgd@sibyte.com>
From: Eduardo Horvath <eeh@turbolinux.com>
List: tech-toolchain
Date: 08/03/2000 08:42:15
On 2 Aug 2000, Chris G. Demetriou wrote:

> eeh@turbolinux.com (Eduardo Horvath) writes:
> > Now to detect a system that's LP64 we need to check a special define for
> > each architecture.  [ ... ]
> > If we start having 64-bit POWER/PPC, 64-bit MIPs, or ia64, these checks
> > will quickly become unweildy.
> 
> So, one can look at these with an eye toward making them easier to do.
> 
> But when I see something which checks for LP64, I think "broken code."
> 
> 
> I did a quick find in the sources (not quite current, and i didn't let
> it run to completion), found two places which matched a grep for the
> string you mentioned:
> 
> 	usr.sbin/dhcp/includes/cf/netbsd.h
> 
> 	usr.sbin/tcpdump/interface.h

In the kernel alone there's:

	isp_tpublic.h
	ip_compat.h
	stat.h

that use __alpha__ as a check for 64-bitness.

> the latter seems like it would be better solved by using c9x-like
> format specifiers (from systems headers) as appropriate, rather than
> locally checking LP64-ness.
> 
> the former seems ... remarkably special.  I see no reason why we want
> to be encouraging people to do things like that.
> 
> 
> Are there examples where this type of check is actually a good thing
> to be doing that my (admittedly incomplete) check of our sources
> didn't find?  8-)

Can't say it's necessarily a good thing.  Although at times it may be a
necessary thing.

Eduardo Horvath