How to transfer a Argument in the macro 
Author Message
 How to transfer a Argument in the macro

Hello, Everyone!

In my application, I want to define a macro as following:

#define aa(bb)  asm("MOV   bb, B")

where the bb in the instruction is the argument transfered by macro aa,
I have tried the #, ##, but the complier tell me that's wrong! How can
I?

My C envirnment support K&R C 2nd Edition!



Fri, 11 Feb 2005 22:29:14 GMT  
 How to transfer a Argument in the macro
* qinjie
| In my application, I want to define a macro as following:
|
| #define aa(bb)  asm("MOV bb, B")
|
| where the bb in the instruction is the argument transfered by macro aa,
| I have tried the #, ##, but the complier tell me that's wrong! How can
| I?

You can take advantage of the fact that adjacent string literals are
concatenated during compilation to write:

  #define aa(bb)  asm("MOV " #bb ", B")

Jeremy.



Fri, 11 Feb 2005 22:31:50 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How can I transfer arguments to thread...??

2. VS:Shortkey macros transferring

3. wrong number of arguments to a macro?!

4. variable argument macros

5. macros with arguments Q

6. Macro with variable arguments

7. wrong number of arguments to a macro?!

8. Variable number of arguments in macros

9. Macros with variable number of arguments?

10. Quote as argument to macro

11. macro with variable arguments

12. Using dynamic number of arguments in a macro

 

 
Powered by phpBB® Forum Software