Date: Thu, 7 Mar 2013 00:38:44 +0400 From: Dmitry Marakasov <amdmi3@amdmi3.ru> To: Bruce Evans <brde@optusnet.com.au> Cc: freebsd-bugs@FreeBSD.org, FreeBSD-gnats-submit@FreeBSD.org Subject: Re: misc/176628: [stdint.h] use safer way of definint __WORDSIZE Message-ID: <20130306203843.GN65471@hades.panopticon> In-Reply-To: <20130304182144.U937@besplex.bde.org> References: <20130304014401.603DB48E@hades.panopticon> <20130304182144.U937@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
* Bruce Evans (brde@optusnet.com.au) wrote: > > __WORDSIZE is always defined as 32, which is wrong on 64bit systems. > > > > I have two solutions for the problem. > > First one uses the same way of testing for 64bit pointers, but doesn't define __WORDSIZE if it can't be detected reliably. > > C++ code should be happier with __WORDSIZE being undefined that with it > being defined to garbage. > > > Second one uses different way of testing for 64bit pointers with checking for __LP64__. > > > > The second one looks much more useful, but I'm not sure if __LP64__ has the right semantics and will work in all platforms. > > Not right, but better than the UINTPTR_MAX test. Both are broken and default > to __WORDSIZE == 32 if pointers are not precisely 64 bits. Actually, the > __LP64__ test is more fragile, since it fails if __L32_P64__ and many systems > use that. Just not any FreeBSD systems, so it is valid to use a hackish > ifdef that only works on current FreeBSD systems. So, what solution do you think is the best in current situation? -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130306203843.GN65471>