I just started using EBasic 1.63 and my program has a lot of unreferenced variables in subroutines. These cause a lot of warnings to be printed in the output window. Although the program works ok, it would be nice to turn off these warnings. Is there a compiler option for this?
When I first installed Ebasic, I put it in the C:\Program Files folder. Then Vista won't let me compile any of the sample projects because the folders are flagged as "read-only" and the exe file can't be written back to the HD. Even though I'm the only one who uses this computer, I can't seem to clear the read-only attributes in the Program Files folder. I finally had to copy the project files to another folder. Does anyone know how to get around this?
Thanks,
Robert
From another posting on the forum
QuoteThe first big thing is that Vista has something called the UAC (User Account Control) that warns you whenever the operating system thinks you're doing something potentially dangerous. Actually, "warn" is an understatement. When this happens, a top-level dialog gets focus and the entire desktop "greys out"; you can't bypass it, and you can't ignore it. You have to respond to the prompt, to either accept the action or not. You can disable UAC, but then you get security warnings that your system is at risk.
I disabled UAC on my wife's laptop.
Larry
From the release annoucement for v1.63:
QuoteThe installation now puts the projects directory under: "My Documents\Emergence Basic\projects" which will allow Vista users to compile that example programs without needing to copy them somewhere else on the drive first. You can always move them after the installation to where ever you want.
Larry
The warnings are there for a reason. Unreferenced variables means you are defining variables but not using them, easy enough to get rid of that warning. Uninitialized variables means you are using a variable before it has been initialized in the subroutine, and the warning is important since local variables are guaranteed to contain random data as they are located on the stack. Consider this subroutine:
sub bad_practice
int a
int b
int c
for a = 1 to 100
b = b + 1
next a
print b
endsub
You will get two warnings. Unreferenced local variable because C is never used, and uninitialized variable because the contents of B are undefined when the FOR loop starts. The warning is there to protect you from writing bad code:
sub good_practice
int a
int b
a = 0
b = 0
for a = 1 to 100
b = b + 1
next a
print b
endsub
While it is not technically necessary to initialize A in this example as the FOR statement does it, you should get into the habit of always initializing local variables, otherwise you will run into some very hard to find bugs when your programs get to be thousands of lines in size.
Paul.
I am sure he was taking about 1.62 Larry, since he isn't a subscriber he can't have 1.63.