[prev] [thread] [next] [lurker] [Date index for 2007/01/31]
------=_Part_607_15812074.1170232761237 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Don't forget BSTR's, the best of them all. Typedef'd as a WCHAR *, so you'd think they are the same, yet the four bytes before the first character contains the length of the string. Greatest idea ever. Hate. On 1/31/07, Yossi Kreinin <yossi.kreinin@xxxxxxxx.xxx> wrote: > > Peter da Silva wrote: > >>On Mon, 29 Jan 2007, Peter da Silva wrote: > > > > > > So you create objects representing external resources like files, > > database tables, locks, and never expose an uncommitted transaction in > > any other way? > > > > > > Of course! Theoretically. In practice there is no automatic way to make > sure > "uncommitted transactions" weren't exposed in other ways; in fact there is > no > automatic way to make sure plain old memory wasn't acquired in other ways > (like > calling malloc or new and assigning the result to a bare pointer). So most > code > is not really exception safe, but it could be written to be. > Theoretically. > > There's a plethora of smart-ass pointers, ranging from std::auto_ptr to > boost::shared_ptr, and a variety of home-made ones; these are supposed to > provide exception safety, among other things, by making sure resources are > released in destructors. Converting between all these pointers, one > smarter than > the other, and figuring out what the hell does the program mean with all > this > intertwingled smart pointing, is one of the reasons C++ programming is the > fun > it is. It's almost as much fun as converting char*, wchar*, std::string, > std::wstring, MFC CString, > MyOwnStringClassIWroteBeforeSTLAndNowItsAllOverThePlaceDamnIt, and other > string > types to each other. > ------=_Part_607_15812074.1170232761237 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Don't forget BSTR's, the best of them all. Typedef'd as a WCHAR *, so you'd think they are the same, yet the four bytes before the first character contains the length of the string. Greatest idea ever. <br> <br>Hate.<br><br><div><span class="gmail_quote">On 1/31/07, <b class="gmail_sendername">Yossi Kreinin</b> <<a href="mailto:yossi.kreinin@xxxxxxxx.xxx">yossi.kreinin@xxxxxxxx.xxx</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Peter da Silva wrote:<br>>>On Mon, 29 Jan 2007, Peter da Silva wrote:<br>><br>><br>> So you create objects representing external resources like files,<br>> database tables, locks, and never expose an uncommitted transaction in <br>> any other way?<br>><br>><br><br>Of course! Theoretically. In practice there is no automatic way to make sure<br>"uncommitted transactions" weren't exposed in other ways; in fact there is no<br> automatic way to make sure plain old memory wasn't acquired in other ways (like<br>calling malloc or new and assigning the result to a bare pointer). So most code<br>is not really exception safe, but it could be written to be. Theoretically. <br><br>There's a plethora of smart-ass pointers, ranging from std::auto_ptr to<br>boost::shared_ptr, and a variety of home-made ones; these are supposed to<br>provide exception safety, among other things, by making sure resources are <br>released in destructors. Converting between all these pointers, one smarter than<br>the other, and figuring out what the hell does the program mean with all this<br>intertwingled smart pointing, is one of the reasons C++ programming is the fun <br>it is. It's almost as much fun as converting char*, wchar*, std::string,<br>std::wstring, MFC CString,<br>MyOwnStringClassIWroteBeforeSTLAndNowItsAllOverThePlaceDamnIt, and other string<br>types to each other.<br> </blockquote></div><br> ------=_Part_607_15812074.1170232761237--There's stuff above here
Generated at 23:01 on 06 Feb 2007 by mariachi 0.52