[vbox-dev] reserved identifier violation
Jens Schweikhardt
Jens.Schweikhardt at Sun.COM
Mon Feb 16 08:56:51 GMT 2009
Markus Elfring wrote:
> Hello,
>
> I would like to point out that some places in the source files do not
> fit to the expected naming conventions of the C language standard.
> http://www.virtualbox.org/ticket/3304
>
> Would you like to adjust any source code for this detail aspect?
The ISO C Standard essentially divides the identifier namespace in two
categories, which I shall name implementation and application name spaces.
ISO 9899:1999 7.1.3 details the implementation name space. Anything not
in the implementation namespace is in the application name space.
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. 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. The __BEGIN_DECLS macro is a good
example for this. The application writer is forbidden to use that macro,
so will never conflict with us. If, however, we had used BEGIN_DECLS we
might conflict with the app writer's BEGIN_DECLS, which he has every
right to define according to ISO C99.
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).
All identifiers in the application name space (basically those NOT
starting with underscores) would however have to be documented, so the
app writer knows where his name space has been invaded.
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.
And thanks for caring about details!
Regards,
Jens Schweikhardt
More information about the vbox-dev
mailing list