Macros are used to make a sequence of computing instructions available to the programmer as a single program statement, making the programming task less tedious and less error-prone.[
18
votes
7answers
2k views
Why aren't macros included in most modern programming languages?
I know that they are implemented extremely unsafely in C/C++. Can't they be implemented in a safer way? Are the disadvantages of macros really bad enough to outweigh the massive power they provide?
17
votes
2answers
458 views
What are the typical applications of Lisp macros?
I am trying to learn some LISP and I have read a lot about the importance of LISP macros so I would like to get some working experience with them.
Can you suggest a practical application area that ...
16
votes
19answers
2k views
Programming languages with a Lisp-like syntax extension mechanism [closed]
I have only a limited knowledge of Lisp (trying to learn a bit in my free time) but as far as I understand Lisp macros allow to introduce new language constructs and syntax by describing them in Lisp ...
13
votes
5answers
2k views
Are C++ templates just a kind of glorified macros?
From different comparisons among C++ templates and C#/Java generics like this one-
...
13
votes
5answers
747 views
How useful are Lisp macros?
Common Lisp allows you to write macros that do whatever source transformation you want.
Scheme gives you a hygienic pattern-matching system that lets you perform transformations as well. How useful ...
13
votes
1answer
588 views
Why does the C library use macros and functions with same name?
I am reading 'The Standard C Library' by PJ Plauger which is really interesting. The book explains not only how to USE the library but also how it is implemented.
I have finished reading the ctype.h ...
9
votes
3answers
384 views
Byte code weaving vs Lisp macros
I have been reading about the libraries people have written for languages like Java and C# that make use of byte code weaving to do things like intercept function calls, insert logging code, etc. I ...
5
votes
1answer
204 views
Lisp Macros: A practical approach
On my way to learn Lisp I have discovered the all powerful and feared so called Macros, then after spending a hard time trying to understand them and their usefulness I said to myself, I FINALLY GOT ...
4
votes
3answers
610 views
Is macros support in a programming language considered harmful?
The first abuse that comes to my mind in C is:
#define if while
But at the same time it is extremely handy and powerful when used correctly.
Something similar happens with Common Lisp macros.
...
2
votes
2answers
221 views
Besides macros, are there any other metaprogramming techniques? [duplicate]
Possible Duplicate:
Programming languages with a Lisp-like syntax extension mechanism
I'm making a programming language, and, having spent some time in Lisp/Scheme, I feel that my language ...
2
votes
3answers
143 views
What do you use macros in your editor for? [closed]
My editor of choice is Notepad++. It has macro capabilities, but as much as I think, I don't see how can I use it for anything.
Do you use macros in your editor that have made your work easier? ...
2
votes
1answer
601 views
Why no more macro languages?
In this answer to a previous question of mine about scripting languages suitability as shells, DigitalRoss identifies the difference between the macro languages and the "parsed typed" languages in ...
1
vote
1answer
144 views
Is there a way to compare and record changes to code without VCS?
I'm working for a client that has no version control system in place. I want to record changes to code without having to add all changes to a spreadsheet. I'm restricted to using Notepad++ so would a ...
1
vote
2answers
202 views
Why can't we declare 'extern C' for C++ macro's?
I am new to C/C++. Wanted to know why we cannot declare 'extern C' for C++ macro's similar to methods/functions...which will allow macro's defined in C++ file to be accessed in .c files.
Thanks in ...
1
vote
2answers
199 views
Using macro as an abstraction layer
I am having a discussion with a colleague about using macro as a thin (extremely) layer of abstraction vs using a function wrapper. The example that I used is
Macro way.
#define StartOSTimer(period) ...
-4
votes
2answers
254 views
Why #pragmas are not part of the C++ standard?
Usually the problem of having possible multiple inclusions is solved with a series of #ifdef #ifndef but the pragmas just solves this with a single line, apparently they are really useful and can make ...