PureBytes Links
Trading Reference Links
|
Hello,
First of all it is NOT ALLOWED to assign value of procedure
(function with NO 'return' statement) call to a variable.
If you want to assign the return value of function call to the
variable the function MUST have "return" statement at the end.
As for the behaviour in question I will
need to check this in detail, but in the meantime you can use this simple
workaround:
procedure
DummyProcedure(array) { local DoNothing;}procedure
DummyProcedure2(array) { local DoNothing;}
TestA = MA(C, 21);TestB = TestA;JunkIgnored =
DummyProcedure(TestA);
/* ENABLING NEXT LINE MAKES TestA == TestB == C; WHY???
*/JunkIgnored = DummyProcedure(1 * C); // instead of C pass 1 *
C
(Multiply all 'built-in' arrays by 1 (you can also add
zero instead), before passing to the function).
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE dir=ltr
>
----- Original Message -----
<DIV
>From:
Dave Merrill
To: <A title=bugs@xxxxxxxxxxxxx
href="">bugs@xxxxxxxxxxxxx
Sent: Wednesday, February 04, 2004 3:09
PM
Subject: Procedure/function parameter
overwrite issue
Hi Tomasz, I'm writing the bug line
about this now, since I'm pretty sure it is a bug, and I have a more specific
set of tests to demonstrate the problem.
<SPAN
class=767435819-03022004>It appears that when you call<SPAN
class=767435819-03022004> any procedure or function with a user array as a
parameter, then call the same function again with one of the reserved-name
arrays as that same parameter, the user array gets overwritten by the
reserved-name array, and so does any other array equal to
it. Here's some demo
code:----------------------procedure DummyProcedure(array)
{ local DoNothing;}procedure DummyProcedure2(array)
{ local DoNothing;}
TestA = MA(C, 21);TestB = TestA;JunkIgnored =
DummyProcedure(TestA);
/* ENABLING NEXT LINE MAKES TestA == TestB == C; WHY???
*///JunkIgnored = DummyProcedure(C);
/* ENABLING ANY OF NEXT LINES DOESN'T *///JunkIgnored =
DummyProcedure2(C);//JunkIgnored = DummyProcedure(TestA);//JunkIgnored
= DummyProcedure(TestB);//JunkIgnored = DummyProcedure(MA(C,
1));//MyClose = C; JunkIgnored = DummyProcedure(MyClose);//JunkIgnored
= DummyProcedure(1);
/* ENABLING THIS LINE CHANGES ONLY TestA, not TestB *///TestA =
50;
Plot(TestA, "TestA", colorBlue);Plot(TestB, "TestB",
colorLightBlue, styleHistogram);Plot(C, "C", colorRed,
styleDots+styleOwnScale);----------------------First
enter this into IB as given
above, and look at the chart<SPAN
class=767435819-03022004>. Now enable thefirst of the commented
out JunkIgnored lines, and notice
that TestA and TestB are both now equal to C.
Comment that line out again, and enable any of the other commented out
JunkIgnored lines; things stay normal.
As a further curiosity, comment those out
again, and enable the TestA = 50 line. It changes only TestA, not TestB. This
is in contrast to the JunkIgnored = DummyProcedure(C) line, which changed both
TestA and TestB, when neither should have changed.
<SPAN
class=767435819-03022004>Hope this is helpful in defining the issue.
Please keep me posted on anything you find out, and of course, if it does
turn out to be a bug, when a fix is available.
Dave
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Sponsor
ADVERTISEMENT
Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|