This is the mail archive of the
mailing list for the GCC project.
Re: Switching to C++ by default in 4.8
On Sat, Apr 14, 2012 at 5:09 PM, Robert Dewar <firstname.lastname@example.org> wrote:
> On 4/13/2012 9:34 PM, Chiheng Xu wrote:
>> On Wed, Apr 4, 2012 at 7:38 PM, Richard Guenther
>> <email@example.com> Âwrote:
>>> Oh, and did we address all the annoyances of debugging gcc when it's
>>> compiled by a C++ compiler? ...
>> Probably, if you can refrain from using some "advance" C++
>> features(namespace, template, etc.), Âyou will not have such
> To me namespaces are fundamental in terms of the advantages that
> moving to C++ can give in a large project, I would never regard
> them as some "advanced" feature to be avoided. If namespaces
> cause trouble for the debugger, that's surprising and problematic!
If debugger fully support namespace, that will be nice. I just say,
in case debugger have trouble with namespace, you can avoid it.
But personally, when I write C++ code, I never use namespace. I
always prefix my class name(and corresponding source file names) with
proper module name, and put the all source files of a module in its
dedicated sub-directory . This make class name globally unique
throughout the project, and facilitate further re-factoring(searching
When using namespace, people can and tend to use the same name in
different namespaces, this seems like a advantage, but I see it as a
disadvantage. If you want to change a name in one namespace to some
other more accurate/proper name, you use some search tools to search
all the references of the name, you will find that the name is
probably also used in other namespaces, so you just can't use "replace
all" command to replace all references with the new name, you must
manually replace them one by one. Is this what you want ?.
And, frankly speaking, I don't like "::". For example A::B, sometime
it means name B in namespace A, sometime it means member B of class A.
This depend whether A is class or namespace. But when you first read
code, this information is unclear, you must guess, until you have read
enough code to known what A is.