From owner-freebsd-bugs@FreeBSD.ORG Wed Mar 6 20:40:01 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7D36C1A3 for ; Wed, 6 Mar 2013 20:40:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 6CDA96E3 for ; Wed, 6 Mar 2013 20:40:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r26Ke1q8071249 for ; Wed, 6 Mar 2013 20:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r26Ke1TQ071248; Wed, 6 Mar 2013 20:40:01 GMT (envelope-from gnats) Date: Wed, 6 Mar 2013 20:40:01 GMT Message-Id: <201303062040.r26Ke1TQ071248@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Dmitry Marakasov Subject: Re: misc/176628: [stdint.h] use safer way of definint __WORDSIZE X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Dmitry Marakasov List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Mar 2013 20:40:01 -0000 The following reply was made to PR kern/176628; it has been noted by GNATS. From: Dmitry Marakasov To: Bruce Evans Cc: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: misc/176628: [stdint.h] use safer way of definint __WORDSIZE Date: Thu, 7 Mar 2013 00:38:44 +0400 * 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