Peter N Lewis wrote:
Does New as a function return nil or does it still give a runtime error?
Runtime error.
If I want to allocate memory, but handle it gracefully if it fails, what are the recommended approaches?
You could call GetMemPtr directly (with all the drawbacks of using GetMem vs. New, as you know), or install your own allocator (wrapper) which returns `UndocumentedReturnNil' (as, e.g. BPGetMem in the System unit does). As the name indicates, this was really a quick kludge, added to support this BP compatibility unit ...
I don't think we have a really nice way to do it ATM.
Frank