Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PARAMETERS() bug?
Message
From
12/11/2002 07:18:56
 
 
To
11/11/2002 13:06:27
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00720910
Message ID:
00721481
Views:
28
Mozemo malo i na nasem srpskom da pricamo ovde, a?

Da, vec su mi rekli nesto slicno. Primenio sam to i sada je sve OK, izbegavam mogucu gresku previse parametara.

P.S. Nadam se da nece neko nesto da prigovori sto se dopisujemo na srpskom!!!

>>I have put PARAMETERS() below the LPARAMETERS to see how much parameters have been passed to my UDF.
>>I have put to see if there was a too low or too many parameters passed.
>>
>>It goes something like this.
>>
>>
>>
>>FUNCTION myUDF()
>>     LPARAMETERS para1, para2, para3, para4
>>          IF PARA() < 2 OR PARA() > 4
>>              RETURN .F.
>>          ENDIF
>>and rest....
>>
>>
>>
>>
>>Now, if there are less parameters passed it returns .F., everything is OK.
>>
>>But, if there are more parameters passed (in this case more than 4), it displays error before program reached to the line where is IF statement, and program is out!!!
>>
>>Why is this happening? Is this a kind of a bug?
>>Is there a way to avoide this?
>
>Actually, this needs some understanding of the calling mechanism. Fox checks the number of parameters before really calling the UDF, and throws the error if there are too many of them. We enjoy the possibility of calling the UDF with fewer parameters - and have the Parameters() (or, better, pcount()) function to check the number actually passed.
>
>Easiest way out of this is just to add ", p11, p12, ..., p27" to your LParameters line. If anyone calls it with more than 27 (or whatever was the physical limit), error surely follows.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform