Assorted C Questions

Gary D Duzan gdtltr at vax1.acs.udel.EDU
Sun Sep 3 06:45:08 AEST 1989


   In may spare time I am starting work on a fairly minimal C compiler for a
fairly minimal system. No flames, please, I am doing this for experience and
fun (not to mention the fact that this system has no real C compiler
available). I have just about finished my preprocessor/tokenizer and am
putting it through some tests. My first question is: how necessary are #if
directives? It seems to me that it adds too much complexity to the
preprocessor. I may add it later, but I think it is a bit too much trouble
at this stage.
   Now for a more important question about macros. Is this legal?

#define min(x,y)	(((x) < (y)) ? (x) : (y))

foobar(min,max)

Sometype min,max;

{}

   Will this foul up the preprocessor since min doesn't have the parameter
list in the function declaration?
   Also, what exactly is a #pragma? An example would help. I am working from
K&R Second Edition and it doesn't say much on the subject.

					Gary Duzan
					Time  Lord
				    Third Regeneration




-- 
      _o_                                                            _o_
    [|o o|]        "Two hearts are better than one." -- Yes        [|o o|]
     |_O_|      "Don't listen to me; I never do." -- Doctor Who     |_O_|



More information about the Comp.lang.c mailing list