Commas within strings passed to macros are interpreted by the compiler as multiple arguments
Numbered Steps to Reproduce Problem:
1. Try to compile code snippet
Code Snippet (if applicable) to Reproduce Problem:
#define MY_MACRO(X) throw EXCEPTION("X = [X]")
/proc/go()
MY_MACRO("a,b,c,d")
Expected Results:
Exception with text X = a,b,c,d
Actual Results:
Compile error (incorrect number of macro arguments)
Does the problem occur:
Every time? Or how often? Every time
In other games? Yes
In other user accounts? Not tested
On other computers? Not tested
When does the problem NOT occur?
When there are no commas present in the passed string
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Not tested
Workarounds:
Use html escaped commas
#define MY_MACRO(X) throw EXCEPTION("X = [X]")
[edit]
I stand corrected. The correct code is what produces the error. The empty [] will not.
I ran a few quick tests, and it appears the problem is that one macro is calling another. If you replace EXECPTION(...) with new/exception(...,__FILE__,__LINE__) the error disappears. So it's the nested macro that's the issue.