You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following results to error XS0165: Use of possibly unassigned local variable 'u'
#pragma options(initlocals,off)
#pragma options(fox2,on) // happens with fox2+ enabled only
FUNCTION Start( ) AS VOID
LOCAL u
u := 1 // error XS0165
Also same warning is reported in this case, but it is correct in this case I assume?
#pragma options(initlocals,off)
#pragma options(fox2,off) // doesn't matter for this one
PROCEDURE Test1()
LOCAL u
DIMENSION u[100] // error XS0165
RETURN
The text was updated successfully, but these errors were encountered:
cpyrgas
changed the title
[VF} Bogus compiler warning about not used variable, when /fox2 is enabled
[VFP] Bogus compiler warning about not used variable, when /fox2 is enabled
Nov 11, 2024
The reason for XS10165 in this code with /fox2 is that when u is an array, then the assignment u := 1 will fill the whole array with the value 1.
For that reason the assignment is translated into: u := XSharp.VFP.Functions.__FoxAssign(u, 1)
The __FoxAssign function needs to know the original type of u to decide what to do.
In the second example the compiler outputs this: u := XSharp.VFP.Functions.__FoxRedim(u, 100u, 0u)
The FoxPro dimension command can be used to redimension an existing array.
OK, I understand. Maybe in the future we can implement a compiler option (re-introduce fox1?) that enables/disables some of such VFP features, so people can still use the VFP dialect, but let the compiler create more robust code (and make more compile-time checks).
Following results to error XS0165: Use of possibly unassigned local variable 'u'
Also same warning is reported in this case, but it is correct in this case I assume?
#pragma options(initlocals,off)
#pragma options(fox2,off) // doesn't matter for this one
PROCEDURE Test1()
LOCAL u
DIMENSION u[100] // error XS0165
RETURN
The text was updated successfully, but these errors were encountered: