From owner-freebsd-hackers Thu Oct 17 16:13:37 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id QAA08222 for hackers-outgoing; Thu, 17 Oct 1996 16:13:37 -0700 (PDT) Received: from rocky.mt.sri.com (rocky.mt.sri.com [206.127.76.100]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id QAA08214 for ; Thu, 17 Oct 1996 16:13:35 -0700 (PDT) Received: (from nate@localhost) by rocky.mt.sri.com (8.7.5/8.7.3) id RAA21461; Thu, 17 Oct 1996 17:13:24 -0600 (MDT) Date: Thu, 17 Oct 1996 17:13:24 -0600 (MDT) Message-Id: <199610172313.RAA21461@rocky.mt.sri.com> From: Nate Williams To: "Eric J. Chet" Cc: Nate Williams , hackers@freebsd.org Subject: Re: C++ question In-Reply-To: References: <199610172119.PAA20617@rocky.mt.sri.com> Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Eric J. Chet writes: > On Thu, 17 Oct 1996, Nate Williams wrote: > > > Any C++ gurus out here? If so, here's a small snippet of a program that > > I am having some questions on. > > > > #if __GNUC__ > > foo::A * // G++ requires this, but Sun's compiler gets lost > > #else > > A * // I prefer G++'s syntax above, but can't for Sun > > #endif > > > > foo::getint(void) > > Remember "A" only exists in foo's namespace. The declaration > has to be: > > foo::A* foo::getint(void) > > If the Sun compiler allows: > > A* foo::getint(void) > > it has a problem. Sun's compiler should return something like > "A* is undefined". Agreed. I should submit a bug to them, but I don't know where to submit it to. ;( > > The above snippet of code compiles fine with g++ and *all* warnings > > turned on, but gives the following warning with Sun's CC compiler > > (latest released version). > > > > fly:/tmp % CC +w -c grpdgram.cc > > "grpdgram.cc", line 12: Warning (Anachronism): foo::A is not accessible from foo::B. > > This is false, foo::A has been defined and is in the same > namespace as foo::B. I agree. > > It's only a warning, but according to the documentation I'm doing > > something that won't be allowed in future C++ releases. > > I have not seen anything disallowing this in the latest public C++ > draft. You can take a look at it: "http://www.cygnus.com/misc/wp/draft" Thanks for the pointer. [ The rest taken offline ] Nate