inc is builtin, not a functionYou're saying builtins cannot be overloaded I presume.
moreover you pass an integer to it, so your call matches inc(single,integer), while inc(integer,integer) and inc(single,single) are defined.That's not a problem. If there is one single then it matches (single,single) signature.
And keep in mind it won't work for properties anyway.Yes, I thought of that.
I call the inc for single/double since yearsI like that. :)
incF (myfloat);
and
incF (myFloat, myDeltaFloat);
inc is builtin, not a functionYou're saying builtins cannot be overloaded I presume.
Create your overloads also for the integer inc......Overload them all...That works. inc is not a keyword :D
But this shadows the system function. Now if I do:
var i: integer; begin ... inc(i, 3); // <- complains about parameter end;
The helper might be a better direction. Sysutils already has a helper for single, so best is to inherit from there.
inc is builtin, not a functionYou're saying builtins cannot be overloaded I presume.
I'm no compiler devel, but I wouldn't bet on it. And even if it was somewhat possible, overloading resolution might work differently. And then third, you expect that to work the same in both compilers.
Create your overloads also for the integer inc......Overload them all...That works. inc is not a keyword :D
But this shadows the system function. Now if I do:
var i: integer; begin ... inc(i, 3); // <- complains about parameter end;
But you must overload them all.
Delphi does not allow inheritance for record helpers :'( (or did they change that with newer Delphi versions?)Ok well then I will stick to IncF. Sounds nice.
Yeah in theory I could overload them all. But I would like to have a reduced footprint on functions for the user of BGRABitmap.As Sven explained, a bunch of overloads have lttle or any footprint for the end-user or code
The helper might be a better direction. Sysutils already has a helper for single, so best is to inherit from there.
Delphi does not allow inheritance for record helpers :'( (or did they change that with newer Delphi versions?)
The helper might be a better direction. Sysutils already has a helper for single, so best is to inherit from there.
Delphi does not allow inheritance for record helpers :'( (or did they change that with newer Delphi versions?)
I don't know, I don't have it. But I'm not sure if it has a single helper by default either, but I knew FPC had :-)
I don't want though to write:
MyLongVariableName:= MyLongVariableName + value
So I think maybe to add a function with another name, like Increment.
Or maybe deriving TSingleHelper and add a method Add, but would that be compatible with Delphi?
Delphi does not allow inheritance for record helpers :'( (or did they change that with newer Delphi versions?)
Well if is just a long variable name that's ok but if it is a long expression with indexing, it may be evaluated twice.I don't want though to write:Why not?
MyLongVariableName:= MyLongVariableName + value