From owner-freebsd-current Tue Jun 18 4:15:30 2002 Delivered-To: freebsd-current@freebsd.org Received: from dignus.com (sdsl-64-32-254-102.dsl.iad.megapath.net [64.32.254.102]) by hub.freebsd.org (Postfix) with ESMTP id 8E9A637B406; Tue, 18 Jun 2002 04:15:24 -0700 (PDT) Received: from lakes.dignus.com (lakes.dignus.com [10.0.0.3]) by dignus.com (8.11.6/8.11.3) with ESMTP id g5IB91h85264; Tue, 18 Jun 2002 07:09:01 -0400 (EDT) (envelope-from rivers@dignus.com) Received: (from rivers@localhost) by lakes.dignus.com (8.11.6/8.11.3) id g5IB9Rq54848; Tue, 18 Jun 2002 07:09:27 -0400 (EDT) (envelope-from rivers) Date: Tue, 18 Jun 2002 07:09:27 -0400 (EDT) From: Thomas David Rivers Message-Id: <200206181109.g5IB9Rq54848@lakes.dignus.com> To: freebsd-current@freebsd.org, obrien@freebsd.org, wollman@lcs.mit.edu Subject: Re: PATCH: wchar_t is already defined in libstd++ In-Reply-To: <20020617202154.B20621@dragon.nuxi.com> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG "David O'Brien" wrote: > > On Mon, Jun 17, 2002 at 06:16:45PM -0400, Garrett Wollman wrote: > > < said: > > > > > The correct approach (and, I have to admit to not > > > glancing at your patch) would be: > > > > > #ifndef __cplusplus > > > typedef _BSD_WCHAR_T_ wchar_t > > > #endif > > > > Actually, the correct approach would be to avoid defining > > _BSD_WCHAR_T_ when compiling C++. This way, it only needs to be done > > I am much more likely to force the libstdc++ build to use our > _BSD_WCHAR_T_. Our types should be centralized and not in some hidden > vendor software that often makes wrong assumptions about us. I accidently sent a reply to just David, so please forgive the duplicate. I think there is a misunderstanding here... It's not that the vendor software has "hidden" the definition of `wchar_t'. The C++ standard mandates that `wchar_t' be a "builtin" type, just like `int'. This is so function overloading can distinguish based on the `wchar_t' type. That is, these would be two *different* functions in a standard- conforming implementation: void foo(unsigned int) { } void foo(wchar_t) { } If `wchar_t' is simply a typedef provided by the headers, then the implementation isn't C++ standard conforming. Also note that the source above is C++ standard conforming, you don't need to #include anything to get the definition of `wchar_t'. gcc v3.x finally gets this correct - and we have to adjust the headers to no longer define a typedef for wchar_t in this situation. This is not a situation of gcc being wrong - it's the opposite - gcc is getting closer to right :-) - Dave Rivers - -- rivers@dignus.com Work: (919) 676-0847 Get your mainframe programming tools at http://www.dignus.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message