[TUHS] early cc variable and function names

Milo Velimirovic milov at cs.uwlax.edu
Fri Oct 17 12:20:23 AEST 2014


External names were limited to 7 (user-defined) characters because the compiler prepended the _ to them. Function names were always external in that era of C. Internal variables could be up to 8 characters. As for longer names, they were allowed but only the first 8 ( including the compiler supplied _ for external names) were signiicant.

I'll look for my documentation from v6.

 - Milo

On Oct 16, 2014, at 8:51 PM, Mark Longridge wrote:

> Hi folks,
> 
> I've been looking at Unix v5 cc limitations.
> 
> It seems like early cc could only use variable and function names up
> to 8 characters.
> 
> This limitation occurs in v5, v6 and v7.
> 
> But when using the nm utility to print out the name list I see
> function test1234() listed as:
> 000044T _test123
> 
> That seems to suggest that only the first 7 characters are
> significant, but when looking at other sources they stated that one
> can use up to 8 characters.
> 
> I hacked up a short program to test this:
> 
> main()
> {
>        test1234();
>        test1235();
> }
> 
> test1234()
> {
>        printf ("\nWorking");
> }
> 
> test1235()
> {
>        printf ("\nAlso working");
> }
> 
> 
> This generated:
> Multiply defined: test5.o;_test123
> 
> So it would seem that function names can only be 7 characters in
> length. I am not sure if limitations of early cc were documented
> anywhere. When I backported unirubik to v5 it compiled the longer
> functions without any problem.
> 
> Did anyone document these sorts of limitations of early cc? Does
> anyone remember when cc started to use function names longer than 7
> characters?
> 
> Mark
> _______________________________________________
> TUHS mailing list
> TUHS at minnie.tuhs.org
> https://minnie.tuhs.org/mailman/listinfo/tuhs




More information about the TUHS mailing list