Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!stan!garya From: garya@Solbourne.COM (Gary Aitken) Newsgroups: comp.windows.x Subject: Re: Toolkit for Open Look *and* OSF/Motif Look and Feel Message-ID: <1991Feb26.230024.22535@Solbourne.COM> Date: 26 Feb 91 23:00:24 GMT Organization: Solbourne Computer, Inc. Lines: 29 > I put code in the new handler to free stuff up and signal an error? That's the problem. There is no way to signal an error in a C++ constructor so that everything unwinds and the base class destructors properly get called to free up their stuff. In the future, when C++ does error/exception handling, there may be a way to do this. > How much of your code actually checks for the return value from oi_create > and does something reasonable with it? How often is that something > more than mapping a (cached) window and saying, "Sorry, out of memory."? Some, certainly not all. However, forcing the pointer to NULL at the time of failure, rather than returning a pointer to garbage in the free/possibly soon to be allocated heap forces recognition of the error at a much earlier phase in the execution of the program -- essentially, the next time it is used. Not doing so could delay recognition of the problem until literaly hours later, and it is potentially much harder to find; certainly much more time consuming > I'm not saying the oi_create stuff is wrong, but I'm not convinced it's > worth the trouble. Suit yourself. You're free to call the constructor directly if you want. -- Gary Aitken Solbourne Computer Inc. ARPA: garya@Solbourne.COM Longmont, CO UUCP: !{boulder,sun}!stan!garya