On Nov 15, 2007 3:42 PM, debasish deka <[EMAIL PROTECTED]> wrote:

> #define     P    1 or 2 etc
> so that while writing the associated handlers I can just write COM##P which 
> would be understood by the preprocessor as COM1 or COM2 etc. and implemented 
> accordingly in the program.  So thats all. Instead of  modifying at many 
> parts of the program we just change the number 'n'.

#define MKPORT (P) COM##P

so MKPORT(1) will get replaced with COM1

COM1 should be either another macro (which will require a re-scan of
the preprocessor when compiling) or a valid identifier (variable or
constant).

I don't think the token pasting operator can be used outside of a
macro definition, i.e.,

switch(com) {

  case COM##P: ...
}

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to