[Digikam-devel] C++ namespace issues

Marcel Wiesweg marcel.wiesweg at gmx.de
Tue Sep 2 11:07:35 BST 2008


> Marcel,
>
> Using namespace X into a code wrapped with X namespace will generate an
> error if the right option from gcc is enable, else it will be fine. I don't
> know other compilers...
>
> But in your case, this will not be a compiler problem, but a Qt moc
> pre-compiler issue. unforget than signal and slots are formated to standard
> C++ by moc before to be played by GCC. So, i think it will fine for us.
>
> Best
>
> Gilles

I have tried to compile with -pedantic, and there is no warning reported from 
gcc. Additionally, Qt docs for moc require that you fully qualify enums and 
typedefs for your own class if you want to use them in slots:
class MyClass
{
Q_OBJECT
enum MyEnum {A,B,C};
signals:
	void mySignal(MyClass::MyEnum enum);
};
which I find pretty similar to the namespace issue.
I will go with this solution for now, we will see if this causes problems on 
other platforms.

Marcel



More information about the Digikam-devel mailing list