I'm trying to create a macro which would make easier to point to a structs member. C开发者_运维问答urrently I am pointing to a structs member in assembly file using the STRUCT_NAME + offset
method.
For example if I want to point structs third member, I would have to do it like this:
STRUCT_NAME + 3
This seems stupid way to do it, and if I insert more members in the struct, I have to update all the offset values in the code.
Is there a way to point using STRUCT_NAME + macro(struct_name, member_name)
?
I`m using texas instruments TMS320C28x hardware.
Thanks!
Your compiler should have the offsetof
macro, not sure if you can use that from within inline-assembly though.
精彩评论