Assorted C Questions

Henry Spencer henry at utzoo.uucp
Thu Sep 7 02:00:04 AEST 1989


In article <4294 at udccvax1.acs.udel.EDU> gdtltr at vax1.acs.udel.EDU (Gary D Duzan) writes:
>... how necessary are #if
>directives? It seems to me that it adds too much complexity...

They are a pain to implement, indeed; there are just enough differences
between #if expressions and normal ones to make trouble for an attempt to
use the same code.  However, I think you will find that the utility of
your compiler is *vastly* increased if it will compile most existing C
programs.  This means you have to implement pretty well all of the language.

>#define min(x,y)	(((x) < (y)) ? (x) : (y))
>foobar(min,max)
>Sometype min,max;
>{}
>
>   Will this foul up the preprocessor...

No; parameterized macro names are recognized as such *only* when followed
immediately by "(".

>   Also, what exactly is a #pragma? ...

It has a totally implementation-defined effect.  It's up to *you*.  If you
just ignore them completely, that would be fine.
-- 
V7 /bin/mail source: 554 lines.|     Henry Spencer at U of Toronto Zoology
1989 X.400 specs: 2200+ pages. | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list