Xref: utzoo comp.windows.x:33068 comp.windows.x.motif:1985 comp.windows.open-look:657 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!shelby!msi.umn.edu!cs.umn.edu!brsmith From: brsmith@cs.umn.edu (Brian R. Smith) Newsgroups: comp.windows.x,comp.windows.x.motif,comp.windows.open-look Subject: Re: Toolkit for Open Look *and* OSF/Motif Look and Feel Message-ID: <1991Feb21.170528.14029@cs.umn.edu> Date: 21 Feb 91 17:05:28 GMT References: <1322@ixos.de> <1057@attc.UUCP> <1991Feb19.210822.26826@visix.com> <1991Feb20.170617.15372@cs.umn.edu> Organization: University of Minnesota, Minneapolis, CSci dept. Lines: 30 In toml@marvin.Solbourne.COM (Tom LaStrange) writes: >} I'm not yet convinced that OI is the One True Schizophrenic >} Toolkit, either. From what little I've seen, it didn't look nearly >} as elegant as InterViews. (InterViews == a different toolkit, also >} in C++) >} I.E. In an example of how to create a scrollbar, they called a >} routine named "oi_create_scrollbar()" or such. This may make sense >} in C, but C++ has constructors. >How do you signal a failure when using a constructor? The >oi_create*** routines basically do a "new" with additional checks to >ensure all of the object's resources were allocated (bitmap files, >fonts, etc.) If the object could not be constructed, a NULL is >returned and all resources that were allocated are freed. If a new fails, a zero is returned. In the constructor for an object (called after the new, or anytime an instance of that object enters scope) you can allocate and check for the resources you mention. If the allocations fail, you can then (if the object was created via new) delete it and return zero. If you're not using pointers to objects, you would probably want to have some member function to verify that the object was initialized successfully. But, the current scheme could be nearly identical with constructors. And more intuitive, IMHO. -- Brian | brsmith@cs.umn.edu |