[previous discussion of using nested ifs for resource
> Because in any of the coding standards I've used and based on the reading
> I've done, 3 layers is enough embedding to go to. Anything else requires
> something more awkward. I'd be tempted to go with the extra
> level but I'd
> run the risk of the code not getting a clean review and having to
> rewrite it
> anyhow. I don't like having to break the code down into anything smaller
> because you have to do extra checking. In this case, because I'm a 'doze
> programmer, I'd rsort to using events and use the
> waitForMultipleObjects API
> to handle that. I have to say I _REALLY_ would hate having to go
> that far.
I think you're missing the point. We're talking about acquiring
resources in general, not waiting for things to happen. Think
malloc() rather than WaitForSingleObject.
Very often a function has to allocate (or create, or open, or
connect to) a resource and be sure to deallocate (or delete, or
close, or disconnect from) this resource before returning.
open input file
open output file
malloc I/O buffer
close output file
close input file
You are talking about waiting for multiple events to happen.
In general, there is no analogue of the "resource deallocation"
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!