Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Long Identifiers for C++

0 views
Skip to first unread message

Bjarne Stroustrup

unread,
Oct 14, 1986, 12:45:36 PM10/14/86
to
> Path: ..!watnot!cgoudeseune (center of gravity @ U of Waterloo, Ontario)
> I hear all these complaints that most C's only support 8-character
> identifiers, and the C++ preprocessor *needs* thirty-two.

These days I think most C compilers do support many characters (Unix SysV,
BSD, and derivatives have VERY long names, Microsoft, DEC, and others support
31 characters). C++ prefers arbitrary long names, but you can live with 31
if you have to.

> Say we use only 7-character letters-only identifiers.
> 26^7 = 8 031 810 176.
> Seeing as how any C++ preprocessor is unlikely to produce over 8 billion
> different identifiers, is there a good reason why a little filter couldn't
> be inserted between C++'s output and C's input to shrink the size of these
> huge identifiers to a manageable size.

There are two practical snags here:

(1) separate compilation: you don't know what identifiers are used in
other separately compiled programs so that it is hard, but not
impossible to make up unique names.

> Sure, it's slow; we've got a 8 MHz 68000.
> Sure, it's a kludge; it works! (I hope)

It does indeed. I once had a version that did it.
However, you will not like it, because

(2) having encrypted your identifiers you'll find it impossible to use
a debugger.

Don't accept short names if you have any choice at all.

0 new messages