do you like?

Ray Butterworth rbutterworth at watmath.waterloo.edu
Sun Feb 21 06:04:27 AEST 1988


In article <906 at PT.CS.CMU.EDU>, edw at IUS1.CS.CMU.EDU (Eddie Wyatt) writes:
> I'm soliticing  comments on two new macro I added to my repetoire of
> useful things.
> IMPORT (geometry.c)       TOKEN vw_trans_at();
> EXPORT (tokenf.c main.c)  void add_to_frametable();

Compare that form with this form:

    extern Token vw_trans_at();   /* defined in geometry.c */
    void add_to_frametable();     /* used by tokenf.c and main.c */

I think both forms say more or less the same thing.

The first form is understandable by you and anyone else familiar
with your style and macros.
The second form is understandable by anyone that has even a small
understanding of C (and English).

The first form looks like it might actually do something, and
the reader will be forced to figure out what the macros do and
be somewhat peeved when he finds they don't do anything.  
The second form is a comment that the reader can use his own
judgement on (e.g. vw_trans_at might actually be in algebra.c
since you rearranged things last month.  And you forgot that
flibit.c also has references to add_to_frametable()).  I've
worked for companies that tried to do such cross referencing
manually.  It was a very expensive overhead, and I'm sure they
got at least 90% of it correct.

If you want to define macros to obscure your code, perhaps you
should enter the obfuscated C contest this year.

But if all you want to do is to comment the code, why not simply
use the standard comment mechanism defined by the language?



More information about the Comp.lang.c mailing list