Common Lisp also has macros, which are much more powerful than their C counterparts. In Lisp, a macro is similar to a function; however, instead of computing a value, a macro instead computes a form to be evaluated in its place. defmacro parses its argument list with destructuring-bind, and thus makes it easy to define a macro with arbitrarily complex syntax. Macros usually make use of backquote. An example (though not very useful) macro definition is:
(defmacro setq-3 (x y z)
  `(progn (setq ,y ,z) (setq ,x ,y)))
macroexpand-1 and macroexpand are useful for finding out exactly what a macro does.

CL macros, unfortunately, are not hygenic; that is, expanding an expression into a macro may cause free variables in the expression to be captured. Judicious use of gensym may help alleviate this problem, but there are cases where more is needed. Beginning with R5RS, Scheme supports hygenic macros, but Scheme isn't Common Lisp.

A prefix, from the Greek makros, large. Common English derivatives include macrophage, macronutrient, and the programming "macro" (because one command does the work of many).

Macintrash = M = macrology

macro /mak'roh/ n.

[techspeak] A name (possibly followed by a formal arg list) that is equated to a text or symbolic expression to which it is to be expanded (possibly with the substitution of actual arguments) by a macro expander. This definition can be found in any technical dictionary; what those won't tell you is how the hackish connotations of the term have changed over time.

The term `macro' originated in early assemblers, which encouraged the use of macros as a structuring and information-hiding device. During the early 1970s, macro assemblers became ubiquitous, and sometimes quite as powerful and expensive as HLLs, only to fall from favor as improving compiler technology marginalized assembler programming (see languages of choice). Nowadays the term is most often used in connection with the C preprocessor, LISP, or one of several special-purpose languages built around a macro-expansion facility (such as TeX or Unix's [nt]roff suite).

Indeed, the meaning has drifted enough that the collective `macros' is now sometimes used for code in any special-purpose application control language (whether or not the language is actually translated by text expansion), and for macro-like entities such as the `keyboard macros' supported in some text editors (and PC TSR or Macintosh INIT/CDEV keyboard enhancers).

macro- pref.

Large. Opposite of micro-. In the mainstream and among other technical cultures (for example, medical people) this competes with the prefix mega-, but hackers tend to restrict the latter to quantification.

--The Jargon File version 4.3.1, ed. ESR, autonoded by rescdsk.

Macros in C can be dangerous if used sloppily.

If I remove the () from the excellent example above, we can prove that 2*2 = 3 !

#define inc_macro(x) x+1



% gcc macrotest.c
% a.out

The reason for this is that it expands to:

which due to order of operations is the same as x+(1*x)+1 or 1+(1*1)+1.

This is why it is a good idea to include () around your expression in a #define.

An alternative in C that does not have this problem is the inline function.

Macros are also those pictures you see popping up in forums that say things like "0WN3D" and other stupid things made to make fun of people or be otherwise amusing. Typically this will be a picture gleaned from wherever, that depicts a weird person or someone making a stupid face. Text is then doctored into the picture, which will make it funny. For example, there is a picture of a nerd sitting at an old Apple computer, and the text reads, "U SUX @ FIREWALLZ CUZ I GOT r00t, LOLERS F4GG0T."

We all know that Macro means large, but it can also be interpreted to mean visible. Macros typically scream visibility, with attention-catching pictures (a kitten in a beer mug, Arnold Schwarzenegger,, etc), and large, bolded text with a bright border to make it stand out even more. Many a flamewar has turned into a war of macros, and many many seconds have been lost to long pageload-times.

Macros are also called macros because they are typically pre-made responses-- shortcuts, if you will, to a certain kind of situation, and the reason they catch on is because there are so many lamers out there.

Many argue that the macro was born in the confines of the infamous SomethingAwful Forums. This is possible and plausible, as many many memes have been born there-- Admiral Ackbar (of It's a Trap! fame), spoofs on Cthulhu, The Terrible Secret of Space, and there is a good chance the greatest (or worst, depends on how you look at it) one of all, AYBABTU was born there as well.

Mac"ro- (?). [Gr. makro`s, adj.]

A combining form signifying long, large, great; as macrodiagonal, macrospore.

<-- macromolecule, macrocosm -->


© Webster 1913.

Log in or register to write something here or to contact authors.