olety / cjass

Preserving cjass code from code.google.com/p/cjass
0 stars 0 forks source link

Problems with stringizing operator in macros #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
===
#define msg(s) = {
    printf(`s`)
}
===

Problem #1
===
msg(    s)

// compiles into
printf("s")

// I expect it to compile into
printf("    s")
===

Problem #2
===
msg(for)

// causes compile error (conflict with for loop)
// probably the same problem with all other keywords?
===

Original issue reported on code.google.com by evgkoc...@gmail.com on 9 Aug 2011 at 12:04

GoogleCodeExporter commented 9 years ago
it's a bad idea, i think. because if i write code like that:
define name(s, s1, s2) = echo('s' + 's1' + 's2)

and use it like that:
name(tro, lo, lo)

i don't want to get a echo("tro" + " lo" + " lo), i only want my code to look 
better.

Original comment by doctorge...@gmail.com on 9 Aug 2011 at 1:40

GoogleCodeExporter commented 9 years ago
> msg(for)
Fixed.

First can't be fixed because backspace - isn't code instructions.

Original comment by adi...@gmail.com on 11 Aug 2011 at 5:59