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 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}")
>>
>>   
> So, expand the macro and you get:
> 
> SET(BAR "CAT")   # text in a macro is just text, BAR is just more text
> MESSAGE("DOG")  # ${BAR} is replaced by DOG sort of like a cpp macro
> MESSAGE(${BAR})  # now we print BAR which was set to CAT in the macro
> 
> -Bill
> 
> 
> 
> 


-- 
Juan Sanchez
[EMAIL PROTECTED]
800-538-8450 Ext. 54395
512-602-4395


_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to