Bug
-
- Posts: 27
- Joined: Jul 07, 2005 12:37
- Location: Malone, NY
- Contact:
Bug
The following code causes an error in XP rather than handling the error within FB. The error is, of course caused by "falling into" the subroutine at line 20.
do
a = a + 1
print a
gosub 20
loop until a = 10
sleep
20 print a*2
return
do
a = a + 1
print a
gosub 20
loop until a = 10
sleep
20 print a*2
return
A bug in your code.
Compiled with –exx:
An end statement after sleep will fix the problem. Your code under QB would have the same problem, and the fix would be the same.
Code: Select all
dim a as integer
do
a = a + 1
print a
gosub 20
loop until a = 10
sleep
20 print a*2
return
Code: Select all
Aborting due to runtime error 12 ("segmentation violation" signal) in junk1.bas:
:()
-
- Posts: 27
- Joined: Jul 07, 2005 12:37
- Location: Malone, NY
- Contact:
I know the end statement would fix it. The code was just to illustrate that FB doesn't handle the error as it should. Instead it causes an XP error which it should never do.MichaelW wrote:A bug in your code.Compiled with –exx:Code: Select all
dim a as integer do a = a + 1 print a gosub 20 loop until a = 10 sleep 20 print a*2 return
An end statement after sleep will fix the problem. Your code under QB would have the same problem, and the fix would be the same.Code: Select all
Aborting due to runtime error 12 ("segmentation violation" signal) in junk1.bas: :()
Tom Lake
Why should FB handle the error? I, for one, would not want the overhead of a safety net. You run the program, it crashes, you find the problem, and you fix it. Seems very normal to me :)toml_12953 wrote: The code was just to illustrate that FB doesn't handle the error as it should. Instead it causes an XP error which it should never do.
-
- Posts: 27
- Joined: Jul 07, 2005 12:37
- Location: Malone, NY
- Contact:
You're probably not a professional BASIC programmer. Those of us who are are used to BASIC taking care of everything as it has since the beginning in 1964. I started programming in BASIC in 1966 and have followed its evolution ever since. I make my living programming nothing but different dialects of it. No well written program should crash the OS (of course no well written OS should crash either but we ARE talking Windows here!). All errors should be handled internally.MichaelW wrote:Why should FB handle the error? I, for one, would not want the overhead of a safety net. You run the program, it crashes, you find the problem, and you fix it. Seems very normal to me :)toml_12953 wrote: The code was just to illustrate that FB doesn't handle the error as it should. Instead it causes an XP error which it should never do.
Re: BUG
Code: Select all
do
a = a + 1
print a
gosub 20
loop until a = 10
sleep
20 print a*2
return
variable). When running, generates nonsence numbers (multiplication
does NOT work), but does not crash.
Code: Select all
REM FreeBASIC "BUG" test
dim a as integer
do
a = a + 1
print a
gosub 20
loop until a = 10
sleep
20 print "::";a*2
return
Windows (illegal activity) and DOS (page fault).
Re: BUG
Huh? Those numbers aren't nonsense: they make perfect sense.StopTCPA wrote:Does NOT crash for me. Generates a warn when compiling (impliciteCode: Select all
do a = a + 1 print a gosub 20 loop until a = 10 sleep 20 print a*2 return
variable). When running, generates nonsence numbers (multiplication
does NOT work), but does not crash.
Code: Select all
1
1 '' 1 * 2
2
4 '' 2 * 2
3
6 '' 3 * 2
'' And so on...
-
- Posts: 27
- Joined: Jul 07, 2005 12:37
- Location: Malone, NY
- Contact:
Re: BUG
[quote="tunginobi]
@toml_12953: Compile with -exx.[/quote]
I know that's what is necessary but my point is it shouldn't be necessary to prevent FB from causing a Windows error.
@toml_12953: Compile with -exx.[/quote]
I know that's what is necessary but my point is it shouldn't be necessary to prevent FB from causing a Windows error.
It was necessary for applications compiled with QB, PDS, and VBDOS, at a time when the OS was relatively fragile. You start this thread with a piece of code that contains an obvious and intentional error, that FB by default cannot catch, and you complain that this is a flaw in FB. I doubt that many here share your desire to program in a sandbox where you are, by default, protected from yourself, no matter what the overhead involved may be.