Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 931129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:27:08+00:00 2026-05-15T20:27:08+00:00

This is a more theoretical question about macros (I think). I know macros take

  • 0

This is a more theoretical question about macros (I think). I know macros take source code and produce object code without evaluating it, enabling programmers to create more versatile syntactic structures. If I had to classify these two macro systems, I’d say there was the “C style” macro and the “Lisp style” macro.

It seems that debugging macros can be a bit tricky because at runtime, the code that is actually running differs from the source.

How does the debugger keep track of the execution of the program in terms of the preprocessed source code? Is there a special “debug mode” that must be set to capture extra data about the macro?

In C, I can understand that you’d set a compile time switch for debugging, but how would an interpreted language, such as some forms of Lisp, do it?

Apologize for not trying this out, but the lisp toolchain requires more time than I have to spend to figure out.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:27:08+00:00Added an answer on May 15, 2026 at 8:27 pm

    I don’t think there’s a fundamental difference in “C style” and “Lisp style” macros in how they’re compiled. Both transform the source before the compiler-proper sees it. The big difference is that C’s macros use the C preprocessor (a weaker secondary language that’s mostly for simple string substitution), while Lisp’s macros are written in Lisp itself (and hence can do anything at all).

    (As an aside: I haven’t seen a non-compiled Lisp in a while … certainly not since the turn of the century. But if anything, being interpreted would seem to make the macro debugging problem easier, not harder, since you have more information around.)

    I agree with Michael: I haven’t seen a debugger for C that handles macros at all. Code that uses macros gets transformed before anything happens. The “debug” mode for compiling C code generally just means it stores functions, types, variables, filenames, and such — I don’t think any of them store information about macros.

    • For debugging programs that use
      macros
      , Lisp is pretty much the same
      as C here: your debugger sees the
      compiled code, not the macro
      application. Typically macros are
      kept simple, and debugged
      independently before use, to avoid
      the need for this, just like C.

    • For debugging the macros
      themselves, before you go and use it somewhere, Lisp does have features
      that make this easier than in C,
      e.g., the repl and
      macroexpand-1 (though in C
      there is obviously a way to
      macroexpand an entire file, fully, at
      once). You can see the
      before-and-after of a macroexpansion,
      right in your editor, when you write
      it.

    I can’t remember any time I ran across a situation where debugging into a macro definition itself would have been useful. Either it’s a bug in the macro definition, in which case macroexpand-1 isolates the problem immediately, or it’s a bug below that, in which case the normal debugging facilities work fine and I don’t care that a macroexpansion occurred between two frames of my call stack.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: This question is more about language engineering than C++ itself. I used C++
This is more a theoretical question than a practical one, but given I undestand
This is a theoretical question more than anything else. In the case of C#
This is a more theoretical question, not a specific scenario: Let's assume, we have
This is more of a theoretical question. When I run a PHP script that
This is more of an academic inquiry than a practical question. Are there any
This is more of an generic XML Schema question, but if and how do
This is more an observation than a real question: MS-Access (and VBA in general)
This is more of a syntax question I'm trying to write a store procedure
This is more of a business-oriented programming question that I can't seem to figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.