What should be added to C

Wayne Throop throopw at dg_rtp.UUCP
Thu Jun 5 07:08:12 AEST 1986


> franka at mmintl.UUCP (Frank Adams)
>> faustus at cad.UUCP

>>You can write arbitrarily large macros by putting backslashes at the end of
>>lines.  This is ugly but it works.
>
> This doesn't let you use "#if" in the body of the macro, as my example would
> require.  To fully explicate, my example would be:
>
> #begdef copy(to, from, number)
> #if sizeof(from) % WORD_SIZE == 0
>    copyword(to, from, number * sizeof(from) / WORD_SIZE)
> #else
>    strncpy(to, from, number * sizeof(from))
> #endif
> #enddef

Along with multi-line-ness, this example has snuck in a *very* large
change in the language.  In particular,

        #if sizeof(from)

In order to evaluate this, the preprocessor would need to know (oddly
enough) the size of "from".  Since the preprocessor currently does not
even know full C syntax, this is a *very* radical change in the
language.
-- 
Wayne Throop      <the-known-world>!mcnc!rti-sel!dg_rtp!throopw



More information about the Comp.lang.c mailing list