Topic: Mangling, name length and the standard


Author: "Piet Van Vlierberghe" <pvv@lms.be>
Date: 1998/03/10
Raw View
> The suggested limit says nothing about name mangling. So far as I can
> tell, the subject of name mangling is nowhere mentioned in the draft
> standard. The suggested limit would apply to the name chosen by the
> programmer, not to what it might look like in the code generated by
> the compiler. (Notice that the suggested minimum for internal or
> macro names is also 1024, and those names are unlikely to be mangled.)

Does this imply that compiler implementations must not have additional
restrictions?

If I write a C++ compiler that complies with all that is in the
standard, but with the additional restriction that mangled names longer
than 8 characters are disallowed, will this compiler be accepted?

Are there any plans for a test suite as part of the standard, comparable
to the ADA standard? If so, will my hypothetical compiler pass?

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: James Kuyper <kuyper@wizard.net>
Date: 1998/03/11
Raw View
Piet Van Vlierberghe wrote:
...
> Does this imply that compiler implementations must not have additional
> restrictions?
>
> If I write a C++ compiler that complies with all that is in the
> standard, but with the additional restriction that mangled names longer
> than 8 characters are disallowed, will this compiler be accepted?

a) A conforming implementation may state that the maximum number of
initial characters in an external identifier is "unknown". The actual
maximum number might depend upon the number of characters added by name
mangling, or by translation of extended multibyte characters in the
source file to UCN's. Alternatively, the documentation could identify a
method of calculating the limit, by calculating the increase in length
of the mangled name, and subtracting that increase from the real maximum
length.

b) The value of that limit is only a guideline, and does not in itself
determine compliance. I suppose the actual limit could be set as low as
0, though that might indirectly cause other kinds of non-compliance
problems  :-}.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: stephen.clamage@sun.com (Steve Clamage)
Date: 1998/03/03
Raw View
In article 7f0acac1@amundsen, "Piet Van Vlierberghe" <pvv@lms.be> writes:
>The standard says about identifiers: (lexical conventions)
>C + + does not place a translation limit on significant characters for
>external identifiers.
>
>Further on, in "Implementation quantities", the following suggestion is
>made:
>Number of initial characters in an external identifier [1 024].
>
>Name mangling, especially in combination with name spaces, using
>declaration and directive, namespace aliases, templates and overloading,
>makes sure that any implementation limit you run into is quite
>unpredictable.

The suggested limit says nothing about name mangling. So far as I can
tell, the subject of name mangling is nowhere mentioned in the draft
standard. The suggested limit would apply to the name chosen by the
programmer, not to what it might look like in the code generated by
the compiler. (Notice that the suggested minimum for internal or
macro names is also 1024, and those names are unlikely to be mangled.)

---
Steve Clamage, stephen.clamage@sun.com




[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: "Piet Van Vlierberghe" <pvv@lms.be>
Date: 1998/02/21
Raw View
The standard says about identifiers: (lexical conventions)
C + + does not place a translation limit on significant characters for
external identifiers.

Further on, in "Implementation quantities", the following suggestion is
made:
Number of initial characters in an external identifier [1 024].

Name mangling, especially in combination with name spaces, using
declaration and directive, namespace aliases, templates and overloading,
makes sure that any implementation limit you run into is quite
unpredictable.

A declaration like

extern void f (X x);

might result in a mangled name of unpredictable length (e.g. typedef Y<Z> X
and so on). This means that, in practice,
almost any modification in the type structure of a software subsystem might
make
dependent software systems run into implementation limits.

Nevertheless, the number of different names that can be generated with
symbol names of
only 8 characters suffices for any imaginable software system.

What kept the standard comittee from demanding that the only type of
limitation would
have to be based on the number of names in a software system, rather than
some uncontrollable property of a name?
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: David Vandevoorde <daveed@cup.hp.com>
Date: 1998/02/22
Raw View
Piet Van Vlierberghe wrote:
[...]
> What kept the standard comittee from demanding that the only type of
> limitation would have to be based on the number of names in a
> software system, rather than some uncontrollable property of a name?

The desire to allow traditional compiler+linker pairs
to be compliant. (Note also that in many software systems
``the number of names'' is a run-time quantity; although
that is  beyond the C and C++ standards.)

        Daveed


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]