With a bit of fiddeling you can use every kind of bracket to basically make function calls in c++

Here are the links to the snippets, all compile and run

Rust: https://godbolt.org/z/bM3d7bG14

OCaml: https://godbolt.org/z/17oMv83zx

C++: https://godbolt.org/z/9Y3WfoE1W

you are viewing a single comment's thread
view the rest of the comments
[–] 23 points 1 week ago* (2 children)

Funny that you put rust as the "uses parenthesis for function calls". When in rust you can use any bracket for macro invocations:

let v1 = vec!(1,2,3);
let v2 = vec![1,2,3];
let v3 = vec!{1,2,3};

These are valid and have the exact same meaning.

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

    That's always funny to me. In a language that's so particular about different syntax features, they let macros of all things have a little bit of arbitrariness.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 6 days ago

    Yeah, I always wonder, if it was an intentional decision or just some first draft that stayed in.

    Because I do think, it's kind of smart. Some macros make sense to call with either () or {}, depending on if you pass a code snippet that's multi-line or not.
    So, you could come up with a complicated syntax to define which bracket types are acceptable, or you could just not bother. 🙃

  • source
  • parent