Boost logo

Boost Testing :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-07-06 12:34:48


Herb and Martyn,

Thanks for the detailed explanations.

Martyn Lovell wrote:

> As others have noted, both istream::read and sgetn were mistakenly
> deprecated, and this has been fixed in our latest builds.

Great!

> [[[
> Aside:
> Someone asked why sgetn got deprecated.

That was me.

> Here is a short version of the
> reason. Consider a much simpler C function, memcpy
>
> memcpy(d, s, cnt);
>
> You can make an argument that cnt is a count of the source, size of
> destination or "both". A reasonable function to add is memcpy_s, which
> clarifies the distinction
>
> memcpy_s(d, dsize, s, scnt);

<snip>

> Early in our implementation we deprecated memcpy (and other cases like
> this), and added memcpy_s. Later in our implementation, we chose to
> undeprecate memcpy (and its ilk), and keep memcpy_s as an alternative
> for those who want it.
>
> sgetn got deprecated (and undeprecated) for similar reasons.

> Essentially, we changed our implementation for a few functions based
> on customer and user feedback, and when we did that, we missed sgetn.
> ]]]

The original rationale for deprecating memcpy makes sense, but I don't see any
connection to sgetn. Memcpy takes two buffers, sgetn just one.
basic_streambuf::sgetn, like, basic_istream::read, is exactly analogous to fread
from stdio.h, which AFAICT has not been deprecated.

> When you see a warning from std::copy, it means that we believe
> you've given us an "unchecked" iterator - either one that is a
> pointer, or one that we cannot establish is "checked". If you have
> custom iterators, you can use traits to mark them as checked. If you
> have code samples that warn where you think they shouldn't please
> submit an issue in the product feedback centre, and we'll investigate
> and fix if possible. The sooner we get these, the better, as we are
> getting close to our release.

Would you mind giving a quick description of how to mark an iterator as checked,
or posting a url?

> Someone noted that their b2 wouldn't install, perhaps because of beta
> 1 detritus. If you can't install b2, you likely won't be able to
> install the final version either. I suggest you open a feedback issue
> and get suggestions on how to clean out your machine.

Me again. I'll do this, because even after running the cleanup tool beta 2
failed to install again yesterday.

Jonathan


Boost-testing list run by mbergal at meta-comm.com