Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What's the secret meaning of this piece of code?
Message
From
03/08/1997 12:29:21
 
 
To
03/08/1997 12:14:56
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00042899
Message ID:
00042991
Views:
39
Cetin,

My suspicion with this piece of coding is similar to yours (as I read you) in that it *probably* came from something which was at one time a subroutine and later was used as a "mainline".
As a *subroutine* the code *COULD* have been inserted when a table had a field called "Cmd_Param" *ADDED* to a *WORKING SYSTEM*, breaking this piece of code when it didn't have the code in question inside of it. So, if *LATER* in the "subroutine" there was a statement along the lines of . . .
Cmd_Param= x + y
then as a *FIELD* this code would suddenly have failed because one cannot do such operations on FIELDs. Since the "subroutine" apparently would not need the actual FIELD anyways, the programmer "solved" the problem as we saw in the "useless code" (which appears now to be truly USELESS). The only "useless" line of code in the scenario I describe is the RELEASE command, and it could be considered "insurance" in case someone later added a Private memvar of the name Cmd_Param in some *HIGHER* routine.

That's my story and I'm sticking to it!

regards,
Jim N

>>>A few lines about this discussion. It's not true that the code does nothing. It releases a variable that may be declared local or public elsewhere.
>>
>>Params are PRIVATE in FoxPro. It means that if you RELEASE a parameter variable, this is released locally, regardless if the same variable exists on a higher level. So, it doesn't make any difference if this is the main ptogram or a called one.
>>
>>BTW, Barbara solved the "mistery": the programmer came from Clipper and in Clipper params are LOCAL and not PRIVATE.
>>
>>>Also you say it's at the beginning of a main program. But every main program could be a procedure for another main program that you forgot that you used before. So it makes it a lower call. Think of this scenario :
>>>* Anothermain.prg
>>>Cmd_param = doacheck()
>>>do main.prg with Cmd_param
>>>if type("cmd_param") = "U" && Released ?
>>> ........
>>>endif
>>>
>>>* This type of code also strange could be used in copy protection.
>>>Cetin
>>
>>How can it be used? I don't see it. :(
>>
>>Vlad
>
>Hey you're talking about only VFP ? What happened to line saying an old program written in 2.6. Should I go to a doctor for my eyes ?
>Try it in FP 2.6 and older versions and see how can you release a public var passed as a parameter. Here is the code to try :
>
>public myvar
>myvar = 12
>do main with myvar
>do second
>
>proc main
>parameters myvar && You think it's private and secure now ?
>myvar = 25
>release myvar && You think again you're only releasing private myvar ?
>
>proc second
>? myvar && Which myvar - declare it first says FP
>
>Still there are programmers like us that should support old FP versions too. Clipper is not the only one doing it that way. And I think you were talking about version 2.6
>Cetin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform