you are viewing a single comment's thread
view the rest of the comments
[–] 3 points 2 years ago (2 children)

Running #define ; anything yields error: macro names must be identifiers for both C and C++ in an online compiler. So I don't think the compiler will let you redefine the semicolon.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 3 points 2 years ago (1 child)

    Haha. Thanks for checking. Given the C pre-processor, I'm sure there's a way to maliciously bork it if someone sets their mind to it.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 2 years ago*

    Well I just tried #define int void in C and C++ before a "hello world" program. C++ catches it because main() has to be an int, but C doesn't care. I think it is because C just treats main() as an int by default; older books on C don't even include the "int" part of "int main()" because it's not strictly necessary.

    #define int void replaces all ints with type void, which is typically used to write functions with no return value.

  • source
  • parent