directives problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mdshafi01
    New Member
    • Jan 2008
    • 36

    directives problem

    please can any one explain me about this

    what is this i do not know please some one tell me

    #define MSG_NAME(name) name, #name
    #define FIELD_NAME(name ) name, #name

    shafi
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    If you do this:
    [code=c]
    #define MSG_NAME(name) name, #name
    ...
    char arr[]="Hello";
    MSG_NAME(arr);
    [/code]

    The macro produces
    [code=c]
    char arr[]="Hello";
    arr, "arr";
    [/code]

    which is a char*,char*.

    When used as a function argument, it's a way of getting the name of the variable compiled into the code. That way a report can be made at run time that uses the variable name in the report.

    Comment

    Working...