Boost logo

Boost :

From: Eugene Lazutkin (eugene_lazutkin_at_[hidden])
Date: 2003-07-19 12:45:40


Inline.

"Jon Biggar" <jon_at_[hidden]> wrote in message
news:bfa3ra$3rt$1_at_main.gmane.org...
>
> For example, on UNIX, to securely create a file, you need to use the
> O_CREAT and O_EXCL flags to ensure that nobody else created the file
> first and is just waiting for you to write to it so they can read what
> you wrote. (There are other ways of circumventing naive security that
> are similar.)

Isn't it classic example on IPC: synchronization, classic readers-writers
problem? Well, it appears everything can be solved using files. :-)

> The C++ I/O library does not give the programmer the ability to set
> those flags, so raw file descriptors or FILE * (using fdopen()) are the
> only solution to the problem.

It looks like this kind of problem should be handled by ISO C++ committee.
It would be more radical solution than using smart handle to accomplish
that.

> Another possibility is interfacing to a legacy C library.

Which one? Is it in wide use? Could you name it? Maybe the best way to deal
with this legacy C library is to provide a functional wrapper.

> Another example is UNIX sockets network programming.

It looks like every college uses "C++ sockets" as an exercise for Comp.Sci.
students. I thought this problem was solved long time ago. Last time I
checked I found numerous implementations. None of them used smart handle as
ultimate solution. All of them were functional wrappers. Hmm, what does
Google say about it now?

And I hate to anger professors leaving students without proper exercise. :-)

Thanks,

Eugene


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