ID:2389183
 
Resolved
#define macro arguments with a trailing slash didn't compile correctly.
BYOND Version:512.1444
Operating System:Linux
Web Browser:
Applies to:Dream Maker
Status: Resolved (512.1445)

This issue has been resolved.
Descriptive Problem Summary:
What the title says - the code won't compile.

Numbered Steps to Reproduce Problem:
1. Run the code snippet below.

Code Snippet (if applicable) to Reproduce Problem:
#define subtypesof(prototype) (typesof(prototype) - prototype)
var/types = subtypesof(/datum/)


Expected Results:
The code compiles.

Actual Results:
The code doesn't compile.

Does the problem occur:
Every time? Or how often?
Always.

When does the problem NOT occur?
Never.

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.)
512.1443 or 512.1442
Lummox JR resolved issue with message:
#define macro arguments with a trailing slash didn't compile correctly.
Descriptive Problem Summary:
If a macro argument other than the last contains a forward slash followed immediately by an open parenthesis, the macro breaks. (The division operator is the only case I can think of in which sensible code causes this, though it happens with any forward slash. Nonsense code that would normally fail at a later compilation step causes it too.)

It's very possible that you already fixed this for 1445 in id:2389183, but the message with which you resolved that doesn't mention this case.

Code Snippet (if applicable) to Reproduce Problem:
1. (Works correctly)
#define add(num1, num2) num1 + num2
/proc/test()
world.log << add(1/2, 1)

2. (Does not work)
#define add(num1, num2) num1 + num2
/proc/test()
world.log << add(1/(2), 1)


Expected Results:
Compile

Actual Results:
1. Works fine
2.
error: incorrect number of macro arguments
error: ,: expected }
error: location of top-most unmatched {


When does the problem NOT occur?
When an open parenthesis does not immediately follow a forward slash in a macro argument, or when the macro argument in question is the last or only one.

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.)
Don't know the exact version when this started, but it was 512.1438 at the earliest. I assume it was more recent than that though.

Workarounds:
Put a space between the / and the (
In response to Exxion
It's definitely the same issue.