Re: Any Sign of Beta Yet?

new topic     » goto parent     » topic index » view thread      » older message » newer message
DerekParnell said...
bernie said...

Matt:

Take a look at memory.e

It defines a TYPE of ' positive_int '

In the ' allocate(positive_int n, integer cleanup = 0) '

Take a look at what will happen if a zero or negative integer is passed to allocate.

I think this will crash the system.

Well, it will crash the application but not the whole system.

Anyhow, what would you rather it do? Attempting to allocate 0 bytes or -N bytes can never return a valid address. So should it prevent the application from continuing (just in case the application doesn't check the result) or should it return 0, like it does when it cannot allocate the requested amount of RAM and hope that the application checks the return value?

What were you expecting it to do?

It will do a crash and not be able to create a ex.err file so the user does not know what function the bad call to allocate() came from. All the user knows is that something caused a type check.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu