Re: define and strings

From: Geoffrey.Coram <Geoffrey.Coram_at_.....>
Date: Tue Jul 26 2005 - 10:40:46 PDT
Arpad -
I don't know where you got the idea that expanding a macro
gets rid of the quotes.  It certainly doesn't happen in C.
The macro expansion simply replaces the formal arguments
with the actual arguments.  Thus, my example from before

`define PRT(x) $strobe(x);

would work for
`PRT("print a string")
`PRT(5.0)

because "print a string" and 5.0 are both valid expressions.

The voltage source you proposed is a very special case;
if you tried to make a nonlinear resistor by passing in
an expression and writing

I(a,b) <+ V(a,b) / (EQ_argument) ;

then you can't expect this to work, because the simulator
needs the symbolic derivatives of EQ_argument to load the
Jacobian.

> After all, the quotes are not displayed on the screen if I say:
>   $display("some text to be displayed");

I don't quite see the relevance; 

  printf("some text"); 

doesn't give you the quotes in C, either, but if you do this:

  #define FOO "different text"
  printf(FOO);

the quotes are retained when the macro is substituted (and
then removed by printf).

-Geoffrey
Received on Tue Jul 26 10:40:51 2005

This archive was generated by hypermail 2.1.8 : Tue Jul 26 2005 - 10:40:54 PDT