Topic: get_temporary_buffer synopsis
Author: Krzysztof =?UTF-8?B?xbtlbGVjaG93c2tp?= <giecrilj@stegny.2a.pl>
Date: Sun, 4 Mar 2012 14:24:57 -0800 (PST)
Raw View
Why does get_temporary_buffer take a signed argument for size?
Why is return_temporary_buffer so awkwardly named? The usual connotation
for "return" is to provide something, not to release something.
Why is there no exception-safe handler for temporary buffers?
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: =?UTF-8?B?RGFuaWVsIEtyw7xnbGVy?=<daniel.kruegler@googlemail.com>
Date: Tue, 6 Mar 2012 08:50:43 -0800 (PST)
Raw View
On 2012-03-04 23:24, Krzysztof elechowski wrote:
> Why does get_temporary_buffer take a signed argument for size?
> Why is return_temporary_buffer so awkwardly named? The usual connotation
> for "return" is to provide something, not to release something.
> Why is there no exception-safe handler for temporary buffers?
The "temporary buffer" API is one example of interface, that presumably
should never have been standardized. It was part of the original HP
library and the basic idea was that it should allow implementations to
provide a very low-level wrapper to get access to some memory that can
be accessed without need to actually increase the currently reserved
heap memory buffer e.g. of malloc. Such small memory buckets can be very
useful for some algorithms that can get a significant performance win if
such a buffer is available. The experiment failed, because no vendor did
anything else but call malloc here, so the advantages of the interface
did only exist theoretically. In addition, the usage requires very
careful programming on the user-side. There exists the suggestion to
deprecate the temporary buffer API for the next standard revision, in
this case there would not be much need for providing further fixes to
the broken API.
HTH& Greetings from Bremen,
Daniel Kr gler
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: Krzysztof =?UTF-8?B?xbtlbGVjaG93c2tp?= <giecrilj@stegny.2a.pl>
Date: Thu, 15 Mar 2012 18:37:20 -0700 (PDT)
Raw View
Daniel Kr gler wrote:
> On 2012-03-04 23:24, Krzysztof elechowski wrote:
>> Why does get_temporary_buffer take a signed argument for size?
>> Why is return_temporary_buffer so awkwardly named? The usual
>> connotation for "return" is to provide something, not to release
>> something. Why is there no exception-safe handler for temporary buffers?
>
> The "temporary buffer" API is one example of interface, that presumably
> should never have been standardized. It was part of the original HP
> library and the basic idea was that it should allow implementations to
> provide a very low-level wrapper to get access to some memory that can
> be accessed without need to actually increase the currently reserved
> heap memory buffer e.g. of malloc. Such small memory buckets can be very
> useful for some algorithms that can get a significant performance win if
> such a buffer is available. The experiment failed, because no vendor did
Isn t it an advantage to skip the default initialisation for POD types? (Of
course, it is then on the programmer not to access unassigned data, but
still?)
> anything else but call malloc here, so the advantages of the interface
> did only exist theoretically. In addition, the usage requires very
> careful programming on the user-side. There exists the suggestion to
> deprecate the temporary buffer API for the next standard revision, in
> this case there would not be much need for providing further fixes to
> the broken API.
I do not consider it broken, for the reason above, but faulty and
incomplete.
Chris
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]