1. Ways to cause an error
Hey gang! I've been looking for ways to cause errors upon the execution of
a statement. Here are the ones I've found so far:
The famous division by zero, i.e.:
? 1/0
The impossible peek:
x=peek4u(#FFFFFFFF)
Pass an invalid arguement to a routine.
Any others? If you have any, please email them to me OFFLIST and in a few
days ill send them to mailing list with all of the ideas in one message
(authors will be noted of course). This will help prevent flooding the
mailing list. :)
Please email them to: icxcnika at hotpop.com
William Heimbigner
2. Re: Ways to cause an error
On Fri, 13 Aug 2004 15:48:17 -0400, "icxcnika at hotpop.com"
<icxcnika at hotpop.com> wrote:
>>Hey gang! I've been looking for ways to cause errors upon the execution of
>>a statement. Here are the ones I've found so far:
>>
>>The famous division by zero, i.e.:
>>? 1/0
>>The impossible peek:
>>x=peek4u(#FFFFFFFF)
>>Pass an invalid arguement to a routine.
>>
>>Any others?
Try these (they are all runtime errors, and compile cleanly)
type h(integer c) return not c end type
h halt
object DIE
sequence s
s="name"
integer i -- or atom
i=1
sequence STOP
procedure x()
-- abort("string") -- argument to abort must be an atom
-- trace("string") -- argument to trace must be an atom
-- halt=0 -- OK
-- halt=1 -- terminates program ("type check failure, halt is 1")
-- DIE+=1 -- variable DIE has not been assigned a value
-- if s="" then end if -- sequence lengths are not the same
-- if s="fred" then end if -- true/false condition must be an ATOM
-- if s then end if -- ""
-- if s=1 then end if -- ""
-- if 1="" then end if -- ""
-- if ""="" then end if -- ""
-- s[0]=1 -- subscript value 0 is out of bounds
-- abort(s[0]) -- ""
-- i[1]=1 -- attempt to subscript an atom
-- abort(i[1]) -- ""
-- s[{1,2}]=1 -- subscript must be an atom
-- abort(s[{1,2}]) -- ""
-- s[3..1]=1 -- slice length is less than 0 (-1)
-- abort(s[3..1]) -- ""
-- s[1..1]="12" -- lengths do not match on assignment to slice
-- i&=1 -- type check failure, i is {1,1}
-- STOP=1 -- type check failure, STOP is 1
-- i=length(1) -- length of an atom is not defined
-- if length(0) then end if -- ""
-- abort(length(0))-- ""
-- if getc(-1) then end if -- bad file number (-1)
-- i=rand(0) -- argument to rand must be >=1
end procedure
x()
Pete