Re: XCode 3.0 header/scope/namespace issues, gcc 4.0 bug?
Re: XCode 3.0 header/scope/namespace issues, gcc 4.0 bug?
- Subject: Re: XCode 3.0 header/scope/namespace issues, gcc 4.0 bug?
- From: Alastair Houghton <email@hidden>
- Date: Mon, 26 Nov 2007 15:52:18 +0000
On 26 Nov 2007, at 14:47, Jeff DuMonthier wrote:
On Nov 26, 2007, at 9:11 AM, Alastair Houghton wrote:
This is one of many areas where the defined behaviour of C++
deviates substantially from programmers' expectations.
That is putting it very charitably, and I used to try to defend C++
from criticisms of it being just too arcane and complicated for
anyone's good.
Indeed, I was being careful to avoid getting flamed by the Bjarne
Stoustrup Fan Club... this, it seems, is a common side-effect of
publicly criticising the design of C++.
I'm sure there's a good reason for the unusual name look-up
behaviour... probably something to do with trying to make adapter
templates work reliably (i.e. where you have a template class B<T>
that inherits publicly from T...) It's just that the result is that
it doesn't do what most people would expect in what is quite a common
case.
Well, the question then becomes which is the better fix: redeclaring
the entire interface and data members of all template base classes
(of template classes) with using clauses in the declaration of every
class with such a base, or adding explicit scoping to every
reference of a data member or member function of a template parent?
If you care about portability, you might like to investigate which
forms work with the other compilers you care about. Otherwise,
"using" sounds a more pragmatic solution in your case. I don't think
it's likely that a future version of the C++ standard will rule
against doing that, as you've explicitly asked to include the name in
the current scope so your intentions are clear.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden