Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!adobe!asente From: asente@adobe.com (Paul Asente) Newsgroups: comp.windows.x Subject: Re: XtMalloc always fails fatally - why? Message-ID: <6218@adobe.UUCP> Date: 1 Sep 90 01:16:04 GMT References: <1990Aug31.105145.22656@axion.bt.co.uk> Sender: news@adobe.COM Organization: Adobe Systems Inc. Lines: 26 In article <1990Aug31.105145.22656@axion.bt.co.uk> CRouch@axion.bt.co.uk writes: >Whenever XtMalloc fails to allocate memory it calls an error message >handler which calls exit, thus terminating the application. What is the >reason for doing it this way, rather than letting the calling procedure >decide what action to take? How often have you written if ((ptr = malloc(...)) == NULL) { error msg } ??? More importantly, how often have you *not* written it when you should? Most applications don't cope with malloc failing, so doing the test for them is a substantial convenience and leads to more correct programs. >More importantly is there any way round this? Sure, use malloc instead. The spec says: -These functions are completely compatible with their standard C language -runtime counterparts so you can mix and match malloc and XtMalloc as you wish. -paul asente New address! asente@adobe.com ...decwrl!adobe!asente