J
Joshua Cranmer
No, it isn’t.
You need to brush up on your reading skills then.
My point exactly.
You failed to completely comprehend what I was getting at.
The specification requires them to be distinct classes--which implies
with distinct code implementations; an implementation can only forgo
that requirement if and only if the code does not actually check to make
sure that it is the case.
So where did it say whether distinct types had to be implemented with the
same or different code?
"Every program shall contain exactly one definition of every non-inline
function or object that is used in that program; no diagnostic
required." (§3.2, clause 3) The specification also goes so far as to
specifically call out that "It is unspecified whether such a variable
has an address distinct from that of any other object in the program."
Given such a statement, it is reasonable to assume that the spec intends
for distinct definitions to correspond to distinct objects unless
otherwise mentioned.
Suffice to say, it is required, in Java, for two instantiations of a
generic type with the same raw type to share the same code, whereas in
C++, there are cases where this simply cannot be the case, and the spec
intends for it to never be the case, so far as the program can tell.