Page 1 of 1

Macros with embedded With

Posted: Wed Dec 16, 2009 1:36 am
by citystate
I noticed that Macros don't allow With...EndWith

why? is there a stack issue or something?

Code: Select all

Structure test
  x.i
  y.i
  z.b
End Structure

Macro ConstructTest(a, b, c, d)
  a=AllocateMemory(SizeOf(test))
  With a
    \x=b
    \y=c
    \z=d
  EndWith
EndMacro

ConstructTest(*var.test, -2600, 100, 10)

Re: Macros with embedded With

Posted: Wed Dec 16, 2009 3:53 pm
by Fred
No, it's a limitation of the PureBasic preprocessor, as 'With/EndWith' are internally handled as macro block as well (so it can't be nested inside a macro).

Re: Macros with embedded With

Posted: Thu Dec 17, 2009 4:50 am
by citystate
thanks Fred