how to tell 64 vs 32 bit architecture ?

Luigi Rizzo rizzo at icir.org
Thu Sep 6 12:55:55 PDT 2007


On Thu, Sep 06, 2007 at 03:25:52PM -0400, Yan wrote:
> Perhaps "if(sizeof(void*)==4) { /* 32 */} else if(sizeof(void*) ==8) { /* 64
> */ }" ?
> 
> Or do you need something for the preprocessor?

preprocessor.

cheers
luigi

> -yan
> 
> On 9/6/07, Luigi Rizzo <rizzo at icir.org> wrote:
> >
> > hi,
> > i was wondering what is the proper way to tell a 64 vs 32 bit
> > architecture.
> >
> > I see that some code in sys/ uses  ' #ifdef __LP64__ ' but i am not
> > sure if this is generic enough (ie not gcc or FreeBSD specific),
> > and also suitable for userland (i.e. works on linux or other platforms
> > as well).
> >
> >         cheers
> >         luigi
> > _______________________________________________
> > freebsd-current at freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-current
> > To unsubscribe, send any mail to "freebsd-current-unsubscribe at freebsd.org"
> >
> _______________________________________________
> freebsd-current at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe at freebsd.org"


More information about the freebsd-current mailing list