LWN.net Logo

Open-before-use

Open-before-use

Posted Apr 1, 2008 12:59 UTC (Tue) by nlucas (subscriber, #33793)
In reply to: Open-before-use by epa
Parent article: How Do I Make This Hard to Misuse?

But you can't do it in practice many times, because it's normal to need to "reopen" the
resource (because of a connection error, the usb device was disconnected, you don't know the
resource name beforehand, etc.), which means the added logic for this case is just the same as
not opening it in the constructor (the default constructor, at least) and providing
"open"/"Close" methods.


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds