-
Key: CPP12-9
-
Legacy Issue Number: 4498
-
Status: closed
-
Source: Triodia Technologies Pty Ltd ( Michi Henning)
-
Summary:
the mapping says in section 1.1.2:
To avoid C++ compilation problems, every use in OMG IDL of a
C++ keyword as an identifier is mapped into the same name preceded
by the prefix "cxx." For example, an IDL interface named "try"
would be named "_cxx_try" when its name is mapped into C++.
For consistency, this rule also applies to identifiers that
are derived from IDL identifiers. For example, an IDL interface
"try" generates the names "_cxx_try_var" and "cxx_try_ptr,"
^^^^^^^^^^^
that is, the IDL compiler behaves as if the interface were
names "cxx_try" and then applies the normal mapping rules.
^ ^^^^^^^Four issues here:
1) I think we have a typo at the first place I highlighed. I
believe it should be "_cxx_try_ptr". (The leading underscore
is missing in the text as it stands now.)2) Typo: It should be '...were named "cxx_try"', not
'... were names "cxx_try"'3) To state that the compiler behaves is if the interface were
named "cxx_try" doesn't explain where the additional leading
underscore comes from because we get cxx, not cxx_
for the mapped identifiers.Unfortunately, changing this sentence to state that the compiler
behaves as if the interface were named "_cxx_try" won't fix
it, because the leading underscore would be dropped by the
IDL keyword escape mechanism.4) The explanations are insufficient:
interface try {};
This will result in "_cxx_try" as the interface name. But what
about the generated tc type code constant? It could be:a) _cxx_tc_try
This mapping would be consistent with the statement that
the "cxx" is a prefix.b) cxx_tc_try
Same as above but, given that, normally, the tc type code
constants already start with an underscore, the escaped
mapping results in a double underscore.c) _tc_cxx_try
This mapping would be consistent with the directive to map
as if the type were named "cxx_try".d) tc_cxx_try
Same as above but preserves the underscore for both the
"tc" and the "cxx", resulting in a double underscore.To me, interpretation (d) seems the most natural and intuitive because
it preserves the leading "tc" for all type code constants (including ones
for identifiers that are C++ keywords). Also, if the mapping of the type
is to "_cxx_try", then it makes sense to have the double underscore because
that is consistent and doesn't make an exception to the rule of "use
"tc" for type code constants and "cxx" for IDL identifiers that are
C++ keywords."Proposal:
Rewrite the above para to read:
To avoid C++ compilation problems, every use in OMG IDL of a
C++ keyword as an identifier is mapped into the same name preceded
by the prefix "cxx." For example, an IDL interface named "try"
would be named "_cxx_try" when its name is mapped into C++.
For consistency, this rule also applies to identifiers that
are derived from IDL identifiers. For example, an IDL interface
"try" generates the names "_cxx_try_var," "_cxx_try_ptr,"
and "tc_cxx_try". -
Reported: CPP 1.1 — Thu, 16 Aug 2001 04:00 GMT
-
Disposition: Resolved — CPP 1.2
-
Disposition Summary:
accept the suggested proposal
-
Updated: Fri, 6 Mar 2015 20:57 GMT