ofstream, fsync and data loss bugs

Joe Buck Joe.Buck@synopsys.COM
Wed Mar 17 23:33:00 GMT 2010


On Wed, Mar 17, 2010 at 04:11:16PM -0700, Pavel Sanda wrote:
> > The new C++ standard acknowledges the existence of POSIX and the
> > threading components provide implementation-defined ways to access
> > non-portable native handles, it's a shame we didn't revisit iostreams
> > to do something similar. I don't have a good answer, and it's too late
> > to deal with it for C++1x.
> 
> Isn't possible that C++ standard could be interpreted in the way that
> you are free to use fsync() inside close() implementation? 

Are you suggesting putting an fsync() in every close()?  That
would be hugely expensive.

It seems that there should be a Posix extension to C++ that would
provide a way to get the Posix file descriptor corresponding to
an fstream.



More information about the Libstdc++ mailing list