Upgrade Guides for Genero BDL / 3.00 upgrade guide |
Several bugs have been fixed in the preprocessor, that can now result in a compilation error.
&define T(x) DISPLAY "head_"#x"_tail" -- macro usage: T(body)
"head_""body""_tail"
And was accepted by the compiler, because it was interpreted as a single string literal.
"head_" "body" "_tail"
However, this will now result in a compiler error, because this is not a valid string literal.
To solve such issue and get the same result string as before version 3.00, use the || concatenation operator in the preprocessor macro and add (escaped) double quotes before and after the #ident placeholder:
&define T(x) DISPLAY "head_""" || #x || """_tail"
&define T(x) DISPLAY 'head_"' || #x || '"_tail'
&define FOO() foo -- macro usage: FOO()bar
foobar
foo bar
And this will result in a compilation error.
Before version 3.00.00 is was possible to use the backslash to escape a comma in preprocessor macro parameters. This syntax is no longer allowed by the preprocessor, it is not a valid usage. To solve such issue, replace parameters by real string literals in the macro:
-- bad coding &define FOO(p1) DISPLAY #p1 FOO(hello world) -- expands to: DISPLAY "hello world" FOO(hello \, world) -- error -- good coding &define FOO(p1) DISPLAY p1 FOO("hello world") -- expands to: DISPLAY "hello world" FOO("hello , world") -- expands to: DISPLAY "hello , world"
&define FOO(name) rec_ ## [ x ] FOO(x)
rec_[ x ]
x.4gl:2:1:2:1:error:(-8042) The operator '##' formed 'rec_[', an invalid preprocessing token.
&define REC_PREFIX(name) rec_ ## name LET REC_PREFIX(customer) = NULL
LET rec_customer = NULL