On Thursday 20 September 2007 20:38:38 Juan Sanchez wrote:
It appears that the set command cannot override a variable specified as
a MACRO argument.
For example:
MACRO (ADD_GADB RCMD)
does not accept changes to RCMD within the macro using the set command.
Is there a way to override this?
Juan Sanchez wrote:
What I was trying to do was to avoid having to create a local variable.
The macro parameter is the default, which can be overridden if necessary.
Now I immediately have to set a new variable with the value of the
parameter. So I now have to account for another variable
I would argue that the following snippet of code should either print
CAT twice or die. Unfortunately it first prints DOG and then CAT.
Thanks,
Juan
MACRO(FOO BAR)
SET (BAR CAT)
MESSAGE(${BAR})
ENDMACRO(FOO)
FOO(DOG)
MESSAGE(${BAR})
Bill Hoffman wrote:
Juan Sanchez wrote:
What I was
Ok,
But cpp doesn't discriminate between ${BAR} and BAR.
#include iostream
using namespace std;
#define foo(x) x = 3; cout x \n;
int main()
{
int y = 1;
foo(y);
cout y endl;
}
Juan
Bill Hoffman wrote:
Juan Sanchez wrote:
I would argue that the following snippet of code should
Juan Sanchez wrote:
Ok,
But cpp doesn't discriminate between ${BAR} and BAR.
#include iostream
using namespace std;
#define foo(x) x = 3; cout x \n;
int main()
{
int y = 1;
foo(y);
cout y endl;
}
I said like cpp, not exactly cpp. The difference is you have to use ${} to
expand
It appears that the set command cannot override a variable specified as
a MACRO argument.
For example:
MACRO (ADD_GADB RCMD)
does not accept changes to RCMD within the macro using the set command.
Is there a way to override this?
Thanks,
Juan
___