Feature Request: Keyword as identifier.
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Fri Sep 29 07:35:39 PDT 2006
icee wrote:
> In C# we can use a keyword as a identifier by prefixing @
>
> Why?
> suppose we are using a extern C lib, the library exports a function as "int
> version()",
> so we write:
> extern(C) int version();
> this will obviously fail to compile, cos' version is a D keyword, (but not
> the C keyword.)
> so we have no methods except modify the C code and re-compile it.
Actually, there's another option: create a C wrapper around it with
another name.
#include "whatever/version.h"
int C_version() { return version(); }
Doesn't help much perhaps, but doesn't require recompilation. Which is
good if you don't have the source of the lib to do so, for instance.
Plus this might compile a lot faster than the lib ;).
More information about the Digitalmars-d
mailing list