-------------------------------------------------------- class foo { #if 1 protected int bar; // Does not work (and is a bug) #else int bar; // Does work #endif this_program other;
protected void create() { other = this; other->bar = 1; } }
object x = foo(); --------------------------------------------------------
This gives a runtime error which seems incorrect to me. Flipping the #if causes it to run flawlessly. Is this a problem in Pike, or are my expectations too high?
This gives a runtime error which seems incorrect to me. Flipping the #if causes it to run flawlessly. Is this a problem in Pike, or are my expectations too high?
This is expected (and correct) behavior, the `->() operator performs "external" indexing. In this case you may want to use the syntax
this::bar = 1;
or
this_program::bar = 1;
/grubba
Henrik Grubbstr?m (Lysator) @ Pike (-) developers forum wrote:
This gives a runtime error which seems incorrect to me. Flipping the #if causes it to run flawlessly. Is this a problem in Pike, or are my expectations too high?
This is expected (and correct) behavior, the `->() operator performs "external" indexing. In this case you may want to use the syntax
this::bar = 1;
or
this_program::bar = 1;
I see. This does not really solve my problem, because I have the reference to the other class instance in a variable "other".
pike-devel@lists.lysator.liu.se