Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2004-03-29 02:40:54


Reece Dunn wrote:

> Vladimir Prus wrote:
>
>> Eljay Love-Jensen wrote:
>>
>> > Take the Standard C Library.
>> > Create a new namespace, "boost::xtd::" for instance.
>> > For every function in the Standard C Library, create an analog in the
>> > "boost::xtd::" namespace.
>> > The analog function would have the same functional behavior as the
>> StdCLib
>> > function, with the notable difference that any errors will generate an
>> > exception.
>>
>> Personally, I find this to be a good idea. Whenever I had to write
>> code like:
>>
>> int controlling_tty = open(ctermid(0), O_RDWR);
>> if (controlling_tty == -1)
>> perror("open");
>>
>> int result = tcsetpgrp(controlling_tty, parent_group);
>> if (result == -1)
>> perror("tcsetpgrp");
>>
>> I really wish there were exception-throwing versions -- since that
>> code is
>> boring and still contains a couple of error-handling problems.
>> However, most
>> of the functions above are acutally from POSIX, not from standard C,
>> so I'm
>> not sure how much wrapped C functions would help me.
>

Unless I'm mistaken, you're talking something similar to Andrei
Alexandrescu's ENFORCE:
http://www.cuj.com/documents/s=8250/cujcexp2106alexandr/

As a side-note, I'm implementing SMART_ENFORCE in the smart_assert library.
Unfortunately in the latest months I did not have time for it. Hopefully
I'll have some time in the next couple of weeks to port it to vc7.1 and
post a new version.

Best,
John


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk