How to return a failure if no segment is found?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to return a failure if no segment is found?

kraftwerk1611
This post was updated on .
Hi,

What is the right way for function alloc()to return a failure to the caller, when no memory segment of the required size is found?

Is returning a value of 0 ok, when false=0 and true=-1?

thanks.
Reply | Threaded
Open this post in threaded view
|

Re: How to return a failure if no segment is found?

cadet1620
Administrator
The specification says that you should call Sys.error(6) if the allocation request cannot be satisfied.

That said, my Memory.jack has a returnErrors(boolean) function that enables alloc() to return 0 when memory requests cannot be satisfied.

--Mark