Re: A question about certain language features
David Cuny writes:
> Yes. But I was more interested in a case like this:
>
> integer i
>
> if rand(10) > 5 then
> i = 100
> else
> -- this will cause an error
> end if
> ? i
>
> and getting:
>
> Warning: private variable i might never be assigned.
At compile time, at each place where a variable is referenced,
Euphoria tries to determine if the variable will definitely be
initialized at that point. If it's not sure that the variable will be
initialized, it outputs an INIT_CHECK opcode to do a run-time check.
See InitCheck() in parser.c
It would be trivial to output a warning whenever an INIT_CHECK
is issued. In most cases, no INIT_CHECK is needed, so there
wouldn't be a huge number of spurious warnings, but I imagine
there would be enough warnings that people would get tired of it.
Regards,
Rob Craig
Rapid Deployment Software
http://www.RapidEuphoria.com
|
Not Categorized, Please Help
|
|