Thanks for your detailed explanation.

Jens Schweikhardt wrote:
> Any library (or API) provider faces a dilemma because he must invade one 
> of the two namespaces. VirtualBox chose to not invade the application 
> name space where practical. This means use of underscores as prefix in 
> places where the application writer is not supposed to use such identifiers.

I find this a questionable design decision.


> While this is technically causing undefined behavior, it is 
> a conscious decision because we support compilation of VirtualBox only 
> on a very limited number of implementations, the implementation 
> namespace of which is known to us.

Would you like to avoid more situations to build on undefined behavior?


> The __BEGIN_DECLS macro is a good example for this.

I imagine that this symbol might be too short to avoid all potential conflicts.


> As for header include guards, using __FOO_H is a common way to not 
> invade the app name space (see libvirt or the python binding for XPCOM 
> and many more).

I have got the impression that this is just a bad habit if the reserved naming 
pattern is used in source code which does not belong to the implementation of a 
(C/C++) compiler.
http://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html

I suggest to use longer names to make important identfiers unique.
http://en.wikipedia.org/wiki/Include_guard#Difficulties


> If you happen to find a real problem due to identifier name clash (in an 
> implementation we support) we'd be of course happy to hear about it.

I try to increase attention for such an implementation detail before software 
developers and users are affected in unexpected ways by wrong applications of 
naming conventions.

Regards,
Markus

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev

Reply via email to