Page 1 of 1

compiler check

Posted: Wed Jul 23, 2008 11:34 pm
by Motu
Hi PB Team :)

today I got a good suggestion from one of my customers for PB function. It would be great if the compiler would check funktion calls with constant value if they are correct or not. For example:

SortArray(MyArray(),#PB_Sort_Ascending) -> fine
SortArray(MyArray(),0) -> fine
SortArray(MyArray(),3422) -> should give a compiler error as 3422 is just rubish

What do you think?

Posted: Wed Jul 23, 2008 11:54 pm
by Kaeru Gaman
*shrug* ...what for?
to slow the compiler down? is it too fast now?

most functions accepting constants accept a wide variety of values,
even a lot of combinations of constants.

Posted: Thu Jul 24, 2008 10:45 am
by Fred
We can add a runtime debugger check for such, should be no problem.

Posted: Thu Jul 24, 2008 12:03 pm
by Tranquil
on runtime it seems okay as this is not a valid parameter.

That would be fine :)

Posted: Thu Jul 24, 2008 9:15 pm
by Motu
Yes, that's a good idea. Thanks :)

Posted: Thu Jul 24, 2008 10:01 pm
by Kaeru Gaman
wich functions would be affected?
will it eat much performance?
would it be optional?

I would like to be able to switch parameter checks off, if I use functions in critical loops etc.
the past few years I got used to that PB is really fast and I have to do my checks myself.

I would not like to lose performance only because some people are not able to check their arguments properly.
there never have been problems before with the way it is now.

Posted: Thu Jul 24, 2008 11:40 pm
by freak
Relax, runtime debugger checks for function parameters have been in PB for years, just not for this particular function/parameter.