how to tell 64 vs 32 bit architecture ?

bruce at cran.org.uk bruce at cran.org.uk
Thu Sep 6 23:33:08 PDT 2007


On Fri, Sep 07, 2007 at 10:39:15AM +0800, Erich Dollansky wrote:
> Hi,
> 
> I have not found a method yet whic works 100% and is portable.
> 
> Luigi Rizzo wrote:
> >On Thu, Sep 06, 2007 at 03:25:52PM -0400, Yan wrote:
> 
> Consider this:
> 
> >>Perhaps "if(sizeof(void*)==4) { /* 32 */} else if(sizeof(void*) ==8) { /* 
> >>64
> >>*/ }" ?
> >>
> and also
> 
> sizeof (int)
> 
> The rest will be platform specific.
>

An int usually remains as 4 bytes on 64-bit platforms; long changes to
64-bit.

--
Bruce Cran


More information about the freebsd-current mailing list