[net.lang.c++] long names

bs@alice.UucP (Bjarne Stroustrup) (06/17/86)

> Reply-To: gdykes@batcomputer.UUCP (Gene Dykes)
> Organization: Theory Center, Cornell University, Ithaca NY
> 
> >Has anybody attempted to port C++ to VMS using the VAX 11 C compiler?
> 
> I am also very interested in this question.  At least one problem with
> the VMS C compiler is that the variable names it allows are somewhat 
> limited in length (32 or 40 characters, I think).  Would it be possible
> to write a C++ post processor that creates suitable names or is that
> an enormous can of worms?
>
> Gene Dykes, 120 Rand Hall, Cornell U., Ithaca, NY 14853 (607)255-6713
> {ihnp4,decvax,allegra,vax135}!cornell!batcomputer!gdykes

I'm told that C++ has been ported to VMS, to Eunice, and MS/DOS all of
which have name length restrictions. I was told it was not hard. It shouldn't
be, but I have no idea what they considered ``hard''. Sorry, I don't have
a name and address for VMS, and (shock horror) many C++ installations -
especially in the commercial and non-Unix worlds are not on the net.

The 31 character limit is no problem for the C++ translator itself or for
the standard libraries only a potential problem for user programs. Most
users will not encounter it, and the users that do encounter it will see
it as a linker problem: Programs that cause very long names that are not
unique in the first X characters will not load. Typically slight modifucations
of the ``offending'' program will remove the problem. Very long names are
generated for
	(1) overloaded functions with many class names in their argument type
		lists. For example:
			class X {
				X& f(X*,Y,Z,Z,Z,Y*,Y*,X);
				X& f(X*,Y,Z,Z,Z,Y*,Y*,Y); // potential problem 
				X& f(Y*,Y,Z,Z,Z,Y*,Y*,Y); // not a problem
			};
		will cause problems on a machine with a 31 character limit for
		names if the class names X, Y and Z has many characters (but
		typically not if they are short names). Note also that because
		the standard encoding maps argument types into names in order
		a differences in the initial argument types curcumvents this
		kind of problems.
	(2) names of arguments and local variables in inline functions (again
		only if you have quite long names in your source text).

The idea of shortening names by a post processor is a can of worms. It makes
debugging truly horrible. If you MUST shorten names do it by modifying
type::signature() in print.c to use a more compact encoding of overloaded
function names.