Topic: local type names


Author: kearns@softrue.UUCP (Steven Kearns)
Date: 23 Feb 91 04:42:13 GMT
Raw View
I am mystified by the logic behind the rule in ARM 9.9, p. 190, that
says "
"you cannot redefine a name inside a class to be a typedefname or classname
if it has already been used by a previous declaration in the class.  "

This is bad on general principles:  i.e. it gives an exception to the general
rule for interpreting names.

Also, it does not really lessen the burden on compiler writers, since now
they have to check, every time a classname or typedefname is declared in
a class, that the name was not previously USED.

It doesnt simplify the interpretation of inline functions, since these have
to be interpreted, at least semantically, at the end of the class declaration,
in which case there is no confusion about what the name refers to.

Also, why are declarations of typedefnames and classnames (mis)treated
thusly, but not variables or functions?

I agree that it is poor style to access a name inside a scope, and then to
redefine the name, however I doubt that it is worth it to make a special
rule to prevent this.  (I believe it would rarely occur in programs found
"in the wild".)  However, if such a rule is instituted, at least extend it
to all names!


********************************************************
* Steven Kearns            ....uunet!softrue!kearns    *
* Software Truth           softrue!kearns@uunet.uu.net *
********************************************************