lunight wrote:
> Hi all,
> I have noticed an amusing macro in the code of hv, here it is :
>
> #define QNAME 123
> #define QNAME_QUEUE_HEAD 0xabc
>
> ! And the function-like macro is:
> #define STOREQ(_name) \
> set _name/**/_QUEUE_HEAD, %g2 \
> !......whatever .....
>
> In the code we could see:
> ......
> STOREQ(QNAME)
> ......
>
> I believe the author want to get this code:
> set QNAME_QUEUE_HEAD %g2
>
> I got totally confused by the use of "/**/" in the macro, which seems
> like "##" in the C lang macro ,but it seems much different from the C in the
> pre-process stage. I believe the macro extension should be:
> STOREQ(QNAME) -> STOREQ(123) -> set 123_QUEUE_HEAD %g2 -> -_-b
>
> but it's not ...
>
> Is there anyone could explain the procedure of this macro-extension? AND
> is there any docs on this topic?
>
> Thanks a LOT!
>
What you're seeing is the use of ancient K&R version of token pasting.
The "##" is "new" to ANSI C, and some older preprocessors don't support
it. I don't know if ## is supported by the preprocessor used by the
assembler.
-- Garrett
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code