Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bug in RETURN TO ... (revisited)
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01378918
Message ID:
01378937
Views:
27
I agree with Agnes, it's not a bug. You're using undocumented feature of the RETURN command. I'm surprised that it works at all. According to VRFP6 help you can either return a value or use TO clause, not both.
RETURN [eExpression | TO MASTER | TO ProcedureName]
>Almost 7 years since I posted MESSAGE# 620507 about this problem, I'm posting it again with some clarification, since it appears to be a bug with broader ramifications than I had originally thought. I suspect that this applies to newer versions of VFP, but I'm not sure, so please let me know. In any case, I'm interested in solving this under VFP 6 SP5.
>
>The issue is that the RETURN TO ... statement, when used to return from an Error event, sometimes returns the wrong value. This turns out to happen in a variety of cases, some of which are illustrated in the following sample program. Previously I had identified one particular case, when a "File does not exist" error occurs on a call to filetostr(). Since then, I've seen this problem in other cases, so I don't think it has to do with filetostr in particular. For example, you can see that it also applies to "Variable not found" errors by uncommenting that test line in this program, and commenting out the filetostr test line. I've seen the problem in other cases too, but there is no such problem for many other types of errors.
>
>I realize that this form of RETURN is a somewhat unusual construct, but it is useful in the context of general purpose error handling. (See MESSAGE# 620313 for more about that.) What I am looking for is some way to reliably return a value of .F. from an Error event to a specified stack level, which is the purpose of the RETURN TO ... statement. I don't want to return the default value of .T., so I need to specify an explicit return value of .F. I've already worked out how to get around the VFP bug that prevents returning a literal .F. via RETURN TO ..., but this solution doesn't work in some cases, because there is yet another VFP bug in the way. Does anyone have a solution to this problem?
>
>Here is the test program:
>
<snip>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform