FW: BON interpreter GME2000COM.h

GME GME
Mon Sep 30 18:03:21 CDT 2002



----------
From: 	Miklos Maroti
Sent: 	Monday, September 30, 2002 12:03:20 PM
To: 	GME Group
Subject: 	RE: BON interpreter GME2000COM.h
Auto forwarded by a Rule

> I don't know if we ought to be discussing macros in this list, but could not resist an
> opportunity to correct Miklos :-)

Ok, so you wanted it, you get it! :)

> Invoking COMVERIFY with something like:
>
>	COMVERIFY(("some_string", long_val))
>
> would be pretty meaningless, because when you have an expression like
>
>	y = (a, b)
>
> y gets the value of b. So, in this case COMVERIFY is passed long_val, and the 
> "some_string" argument is simply ignored.

Yes, if you evaluate the argument then you get long_val. But COMVERIFY is a macro, and free to do whatever it wants with its argument: it can display the whole argument as a STRING in a dialog box where the "some string" will not be ignored. Look:

#define ASSERT(condition) if(!(condition)) \
	AfxMessageBox("Assertion failed: " #condition)

Then

ASSERT(("this should never happen", false));

expands to

if(!(("this should never happen", false))) \
	AfxMessageBox("Assertion failed: " "(\"this sould never happen\", false)");

I hope it works. (the two strings "xxx" "yyy" gets concatenated by the compiler).
Sorry, I just could not resist... :)

Miklos



More information about the gme-users mailing list