#define test1 test_1
#define test2 test_2
#define concat(a,b) a.b
test1.test2 '--> test_1. test_2 there a space after the dot.
concat(test1,test2) '-->test_1.test_2
I don't understand all the arcane rules regarding #defines, but by trial and error I found that giving test2 an empty argument list suppresses the initial space:
#define __conc__( a, b... ) a##b
#define __nfcall__( a, b ) __conc__( a., b )
namespace foo
sub _
bar()
? "Bar"
end sub
end namespace
__nfcall__( foo, bar )
sleep()
You need another macro so that it expands correctly.
#include "fbgfx.bi"
#define test1 fb
#define test2 sc_escape
#define concat(a,b) a.b
namespace foo
sub _
bar()
? "Press <esc>"
end sub
end namespace
do
locate 4,,0
concat(foo,bar)
if multikey(concat(test1,test2)) then exit do
loop
print "Press any key . . ."
sleep()
I suppose that's a good thing, actually. Imagine if you *needed* a leading space for some reason and couldn't otherwise get one-- because the preprocessor would interpret a leading space as a separator between tokens instead of being part of a token itself, or compress consecutive spaces into one. Now we know we can suppress a leading space if we need to, or include it if we need to.