compiler check

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Motu
Enthusiast
Enthusiast
Posts: 160
Joined: Tue Oct 19, 2004 12:24 pm

compiler check

Post 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?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

We can add a runtime debugger check for such, should be no problem.
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post by Tranquil »

on runtime it seems okay as this is not a valid parameter.
Tranquil
Motu
Enthusiast
Enthusiast
Posts: 160
Joined: Tue Oct 19, 2004 12:24 pm

That would be fine :)

Post by Motu »

Yes, that's a good idea. Thanks :)
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Relax, runtime debugger checks for function parameters have been in PB for years, just not for this particular function/parameter.
quidquid Latine dictum sit altum videtur
Post Reply