James,
yes, that's exactly what you get using /a.
EMG
So using /a you don't lost any of the benefits of variable declaration.
James Bott wrote:There is a warning generated for cDate in the DoSomething() function.
- Code: Select all Expand view
Function Main()
#include "fivewin.ch"
public cDate
memvar cDate
cDate:= dtoc(date())
doSomething()
Return nil
Function doSomething()
msgInfo( cDate ) // warning generated here
return nil
Function Main()
memvar cDate
#include "fivewin.ch"
public cDate
cDate:= dtoc(date())
doSomething()
Return nil
Function doSomething()
msgInfo( cDate ) // warning generated here
return nil
#include "fivewin.ch"
memvar cDate
Function Main()
public cDate
cDate:= dtoc(date())
doSomething()
Return nil
Function doSomething()
msgInfo( cDate ) // warning generated here
return nil
James Bott wrote:I am trying to get warnings for every undeclared variable used in every function.
FUNCTION MAIN()
PUBLIC cVar := "This is a test"
RETURN NIL
FUNCTION TEST()
? cVar // warning here
? M -> cVar
RETURN NIL
James Bott wrote:I am trying to get warnings for every undeclared variable used in every function. This forces me to declare all of them at the top of the function.
James Bott wrote:Maybe I actually could do both. First your way, declaring all the publics at the top of the file, then I would only get warnings for undeclared locals. Once I got all those declared, then I could remove the MEMVAR declarations and get warnings for all the publics.
May be it's not so easy. It depends on how vars are being used: a LOCAL can't replace a PRIVATE, because the scope of PRIVATEs go beyond the current function to the called ones. Fortunatelly in your case every var has it's own (weird) name, so it will be easy to find the usage of vars outside the funtion it's been declared and add it to the function parameters.
What's your plan? PUBLIC => STATIC and PRIVATE => LOCAL?
Yes, my editor will do that.SublimeText and xEdit has wonderfull features to refactorize your code, replacing strings in all files simultaneously.
Anyway, it seems to be a significant task. May be a code analyzer can help. There were several for Clipper, although I've never used them.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 58 guests