Identifier significance CHALLENGE

ldl at genix.UUCP ldl at genix.UUCP
Tue Dec 13 17:49:17 AEST 1983


  In light of the fact that we (programmers) cannot depend on having
identifiers of more than 'n' characters, I have taken to writing code
somewhat differently.  I 'beat up' on cpp's features.  I'm not too sure
if this plan will really work, but it does on our V7 environment.

In a header:

  #define foobarthere   snm00		/* routine description */
  #define foobarhere    snm01		/* routine description */

In code:

  foobarthere(...)
  {
      ...
    foobarhere(...);
      ...
  }

  foobarhere(...)
  {
  }

Notice that in the source code, the 'long ids' are used. The macro
processor 'remaps' the names into something that the compiler can
handle, but that the user doesn't have to think about it.

A further use of this (needed in my case) is that there are several
'support' routines (our stuff is divided into libraries) that are
called by the 'main' routines in the library.  Using this technique,
there is no need to be concerned about having routines in one library
uniquely named from all other routines.  The 'real' name is controlled
by the 'remapped' name that is handled by cpp.

At first, I was rather concerned about the 'limits' of C external
tags, etc, but using the above technique, no problems have been 
encountered to date (and over 80000 lines of lex, yacc, and C).

Use cpp! 

P.S.  I have hit the limit of 'too much defining' in one area. I took
      care of this by building a simple interface that uses m4 (yuck! 
      for C).  I still work in 'pure' C, and let a couple of scripts
      and make work out the details.

-- 
Spoken: Larry Landis
USnail: 5201 Sooner Trail  NW
        Albuquerque, NM 87120
MaBell: (505)-898-9666
  UUCP: {ucbvax,gatech,parsec}!unmvax!genix!ldl



More information about the Comp.lang.c mailing list