News for hackers. Stuff that matters.
Re:How Lisp macros differ from static code-generation and me... by dexen on Thursday January 27, 2011 @02:48AM (#2147031)
A C macro can't directly -- nor indirectly -- refer to itself; even through other macro. You can't do loops, you can't do recursion.

(a nonsensical example, as I can't think of a proper one right now)

#define PRINTFOO PRINTBAR

#define PRINTBAR PRINTFOO

PRINTFOO

The ANSI C standard says a macro, while it is being expanded by the preprocessor, ``is painted blue'' (is no subject to further expansion).

I'm not sure, but probably it follows the C macros are not Turing-complete.

EDIT: on the other hand, a LISP macro system is a Turing-complete programming language that's geared towards manipulating lists of symbols and values (which, incidentally, is LISP program).

Re:How Lisp macros differ from static code-generation and me... by nkurz on Saturday January 29, 2011 @05:32PM (#2156624)
Do you have a link for the "painted blue" reference? I agree with your explanation, but had never heard that particular phrasing and was intrigued by it. But searching on Google for things like 'expand ansi macro "painted blue"' returns only your comment and a scraped spam site of someone answering a similar question.
Re:How Lisp macros differ from static code-generation and me... by dexen on Monday January 31, 2011 @02:49AM (#2160674)
Indeed surprisingly hard to find a first hand reference. But http://duckduckgo.com/?q=%22painted+blue%22+expansion returned link to wikipedia article, which, in turn, links to some meta-document about new C standard. There's also some post on Boost (library) mailing list: http://duckduckgo.com/?q=macro+%22painted+blue%22+boost -> http://lists.boost.org/Archives/boost/2006/01/99264.php

Perhaps I was wrong; perhaps the phrase was in K&R C? Can't find the book online @_@;;

Re:How Lisp macros differ from static code-generation and me... by cyrus_ on Thursday January 27, 2011 @02:57AM (#2147053)
correct, not Turing-complete
Re:How Lisp macros differ from static code-generation and me... by Locke1689 on Thursday January 27, 2011 @08:10AM (#2147646)
Note that this was, in fact, by design. Anyone who seeks to make C more complicated than this should be shot on sight.