Function not allowed twice in the same expression

List of known bugs
Locked
Author
Message
User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Function not allowed twice in the same expression

#1 Post by zristic » 27 May 2005 12:33

Bug ID: #050527001
Submitted by: zristic

Severity: Moderate
Status: fixed in version 5.0

Description:
If one function that returns value is called more than once within a single expression, each new call will overwrite the result of the previous one. For example:

Code: Select all

i := My_Function1(2) + My_Function1(5);
will not compile properly.
This does not apply to different functions, e.g.

Code: Select all

i := My_Function1(2) + My_Function2(102) + My_Function3(23) + ....;
will work OK.


Workaround:
Use one call per expression:

Code: Select all

i := My_Function1(2);
i := i + My_Function1(5);
...

Locked

Return to “mikroPascal Bug List”