Macro expansion help
Jonathan Morton
chromi "at" cyberspace.org
Wed, 15 Mar 2000 20:36:07 +0000
>Could someone please "hand" generate the source code resulting when the
>following
>macro is expanded using DEFINE_HEXTILE(16)? I understand the "token passing"
>mechanism when ## is used (ie. ##bpp expands to 16) but what about bpp
>references
>not preceded by ##. And what about the second ## in
>COLOR_FROM_PIXEL##bpp##_ADDRESS(&bg)?
>Thanks for any insight.
i think, in macros, if an expansion happens 'on it's own': eg. foo(bpp);
then it doesn't need the ## token. This would expand to foo(16);, say.
However, if it's at the end of a word, or in the middle, say: CARD##bpp
(CARD16) or FOO##bpp##BAR (FOO16BAR) it needs to be delimited by the ##
tokens to prevent it being treated as part of a larger symbol. for example
CARDbpp wouldn't expand at all but remain as CARDbpp.
Of course, if i'm horribly wrong, someone please correct me <grin>. I'm
not a macro guru myself - I just attempted to figure it out from my old C
textbook.
--------------------------------------------------------------
from: Jonathan "Chromatix" Morton
mail: chromi "at" cyberspace.org (not for attachments)
uni-mail: j.d.morton "at" lancaster.ac.uk
The key to knowledge is not to rely on people to teach you it.
--------------------------------------------------------------
Contributing to the VNC Project - http://www.uk.research.att.com/vnc/
Macintosh VNCserver v3.3.2 beta2.2 now posted at:
http://chromatix.autistics.org/vnc/
---------------------------------------------------------------------
To unsubscribe, send a message with the line: unsubscribe vnc-list
to majordomo "at" uk.research.att.com
See also: http://www.uk.research.att.com/vnc/intouch.html
---------------------------------------------------------------------