What does this mean?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RedSon
    Recognized Expert Expert
    • Jan 2007
    • 4980

    What does this mean?

    #define _AFX_FUNCNAME(_ Name) _Name##W

    Whats the ##W part of that?
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Originally posted by RedSon
    #define _AFX_FUNCNAME(_ Name) _Name##W

    Whats the ##W part of that?
    ##W concatenates the W with the value passed to the #define.

    Change theW to _Name and print the value like this
    [code=c]
    #define _AFX_FUNCNAME(_ Name) _Name##_Name

    printf("%s\n",_ AFX_FUNCNAME("t est"));

    [/code]

    Raghuram

    Comment

    • RedSon
      Recognized Expert Expert
      • Jan 2007
      • 4980

      #3
      Originally posted by gpraghuram
      ##W concatenates the W with the value passed to the #define.

      Change theW to _Name and print the value like this
      [code=c]
      #define _AFX_FUNCNAME(_ Name) _Name##_Name

      printf("%s\n",_ AFX_FUNCNAME("t est"));

      [/code]

      Raghuram
      So the output would be "_Nametest_Name "?

      Comment

      • gpraghuram
        Recognized Expert Top Contributor
        • Mar 2007
        • 1275

        #4
        Originally posted by RedSon
        So the output would be "_Nametest_Name "?

        No i got a different output like "testtest"


        Raghuram

        Comment

        • weaknessforcats
          Recognized Expert Expert
          • Mar 2007
          • 9214

          #5
          Read up on the preprocessor token-pasting operator.

          This is replaced in C++ with templates.

          Comment

          Working...