A89: (C language) Macro Expansion
[Prev][Next][Index][Thread]
A89: (C language) Macro Expansion
Since there is no group for C programming on the 89/92+, I assume this is
probably the most appropriate place to post this message.
I would like to create macros which are assembly statements, but the trick
is that I want to be able to change what the assembly statement is.
For instance, I know it is possible to do this:
#define MY_MACRO(x) asm("\n" x ": .byte 0\n");
MY_MACRO(MyByte)
But things get more complicated. I would like to be able to pass numbers as
parameters, and have them included in the string. For example:
#define DECLARE_POINT(x,y) asm("\nMyRect: .long " x ", " y "\n");
This will work only if x and y are literal strings, f.x.
DECLARE_POINT("3","4")
Is there any way to do this without passing literal strings, f.x.
DECLARE_POINT(3,4) ?
I know you're going to say that I'd be better off just declaring my
variables in the normal C syntax, but I've already tried that, and if I can
get this to work it would make my code a _lot_ more readable (believe it or
not).
Thanks,
Mark Leverentz
Follow-Ups: