How to debug a macro

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • AS

    How to debug a macro

    Hello,
    Can anybody tell me how to debug a macro ?

    for ex,

    #define PRINTSTRING() \


    CString str = _T("hello"); \

    AfxMessageBox(s tr); \


  • Victor Bazarov

    #2
    Re: How to debug a macro

    AS wrote:
    Can anybody tell me how to debug a macro ?
    >
    for ex,
    >
    #define PRINTSTRING() \
    >
    >
    CString str = _T("hello"); \
    >
    AfxMessageBox(s tr); \
    Most compilers support an option to output the result of
    preprocessing. RTFM and see if yours does as well. Then
    use your macro and see what it expands into.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask


    Comment

    • Ian Collins

      #3
      Re: How to debug a macro

      AS wrote:
      Hello,
      Can anybody tell me how to debug a macro ?
      >
      Rewrite it as an inline function.

      --
      Ian Collins.

      Comment

      • Victor Bazarov

        #4
        Re: How to debug a macro

        Ian Collins wrote:
        AS wrote:
        >Hello,
        >Can anybody tell me how to debug a macro ?
        >>
        Rewrite it as an inline function.
        With all due respect, declarations cannot be rewritten as
        inline functions.

        V
        --
        Please remove capital 'A's when replying by e-mail
        I do not respond to top-posted replies, please don't ask


        Comment

        • Ian Collins

          #5
          Re: How to debug a macro

          Victor Bazarov wrote:
          Ian Collins wrote:
          >Victor Bazarov wrote:
          >>Ian Collins wrote:
          >>>AS wrote:
          >>>>Hello,
          >>>>Can anybody tell me how to debug a macro ?
          >>>>>
          >>>Rewrite it as an inline function.
          >>With all due respect, declarations cannot be rewritten as
          >>inline functions.
          >>>
          >Did you read the OP's example Victor?
          >
          Yes, I did. It contains a declaration.
          >
          So it does. That'll teach me to post before breakfast!

          --
          Ian Collins.

          Comment

          Working...