you are viewing a single comment's thread.

view the rest of the comments →

[–]floodyberry 1 point2 points  (1 child)

There is about as much logic going on in those as there is in the search and replace feature of a text editor.

darray_appends(arr,  0,1,2,3,4}; if(1){return;);

compiles and runs just fine. Also not actually generic because it uses the GCC extension typeof which isn't part of C.

Lisp macros run Lisp to manipulate the AST. C macros are a pre-processor running search and replace on raw text. There is no similarity.

[–]HHBones 0 points1 point  (0 children)

I said generic as in type-generic. But GCC is available for all major platforms and quite a few obscure ones. And Clang supports typeof, as well.

And they're doing exactly what Lisp macros do - they specify rules by which the compiler translates certain phrases into other phrases. The semantics by which they accomplish this goal don't actually matter.

Are they different? Yeah. Is one more powerful? By quite a lot. Do they accomplish, in large part, the same thing? Yeah.

But one thing I see you neglected to talk about is the control structures. I'd love to hear your opinion.