Olav
2008-10-27 20:46:15 UTC
Hi,
In the code below, should not a decent compiler at least give the programmer
a warning in a situation like this?
Ooops, if I haven't been on Mister Zale's unwanted customers list before; I
surely will be now. The sentence above is all it takes.
--
Olav
#COMPILE EXE "C:\Test"
#DIM ALL
#DEBUG ERROR ON
#TOOLS ON
#COMPILER PBCC 4.04
'---------------------------------------------------------------------------------------------------------------------------------------
FUNCTION PBMAIN () AS LONG
LOCAL a AS BYTE
LOCAL b AS LONG
ON ERROR GOTO ErrorHandler
b = 256
a = b 'a equals 0, but the compiler does not issue a warning nor an
error about the overflow
? "Value of a is:" a
? "Press a key to end the program..."
WAITKEY$
Leave:
EXIT FUNCTION
ErrorHandler:
? "Error:" + ERROR$(ERRCLEAR)
RESUME Leave
END FUNCTION
In the code below, should not a decent compiler at least give the programmer
a warning in a situation like this?
Ooops, if I haven't been on Mister Zale's unwanted customers list before; I
surely will be now. The sentence above is all it takes.
--
Olav
#COMPILE EXE "C:\Test"
#DIM ALL
#DEBUG ERROR ON
#TOOLS ON
#COMPILER PBCC 4.04
'---------------------------------------------------------------------------------------------------------------------------------------
FUNCTION PBMAIN () AS LONG
LOCAL a AS BYTE
LOCAL b AS LONG
ON ERROR GOTO ErrorHandler
b = 256
a = b 'a equals 0, but the compiler does not issue a warning nor an
error about the overflow
? "Value of a is:" a
? "Press a key to end the program..."
WAITKEY$
Leave:
EXIT FUNCTION
ErrorHandler:
? "Error:" + ERROR$(ERRCLEAR)
RESUME Leave
END FUNCTION