Operator overloading
#1

I can't seem to get this to work correctly,

[code=pawn]#include <a_samp>

stock Somethingperator--(Somethingper)
return Something_per - 1);

stock Somethingperator++(Somethingper)
return Something_per + 1);

public OnFilterScriptInit()
{
new Something:a = Something:5, Something:b = Something:5;
a++;
b--;
printf("a = %i, b = %i", _:a, _:b);
return 1;
}[/code]

gives

Quote:

a = 6, b = 6

but if I just have the decrement operator and not the increment operator it gives the expected value. Am I doing something wrong or is this a compiler problem?
Reply


Messages In This Thread
Operator overloading - by Dabombber - 21.07.2009, 00:28
Re: Operator overloading - by Correlli - 21.07.2009, 00:32
Re: Operator overloading - by Dabombber - 21.07.2009, 00:45
Re: Operator overloading - by Correlli - 21.07.2009, 00:56
Re: Operator overloading - by Dabombber - 21.07.2009, 01:05
Re: Operator overloading - by yezizhu - 21.07.2009, 01:15
Re: Operator overloading - by Correlli - 21.07.2009, 01:24
Re: Operator overloading - by yezizhu - 21.07.2009, 01:32
Re: Operator overloading - by Correlli - 21.07.2009, 01:34
Re: Operator overloading - by Dabombber - 21.07.2009, 07:55

Forum Jump:


Users browsing this thread: 2 Guest(s)