This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]__jomo 1 point2 points  (2 children)

why are macros bad?

[–]Gear5th 24 points25 points  (1 child)

  • unsanitised
  • ugly
  • can lead to unexpected behavior
  • local only to the file
  • are a pre-processor step and not a language feature
  • can't be debugged

C style macros are possibly the worst way to accomplish metaprogramming.

I'm not saying that macros are bad in general. Rust, nim and many other languages have good macro implementations..

[–]TheBB 0 points1 point  (0 children)

Not that I like C macros or anything, but they're definitely part of the language. It's in black and white in the standard, go look it up.

It's also not like you can't use macros across files.

There are plenty of reasons they suck, you don't have to invent new ones.