summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/std/std_memory.h
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-09 08:23:02 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-09 08:23:02 +0000
commit0c7a5c66fbdd63816794dc1f23b41ec98d3b11af (patch)
tree06aec861b66855d311549b98914b1cee7d0e5e75 /libstdc++-v3/include/std/std_memory.h
parentfac992ef71601620e3ed3ea15c13ecf61b62f92a (diff)
downloadppe42-gcc-0c7a5c66fbdd63816794dc1f23b41ec98d3b11af.tar.gz
ppe42-gcc-0c7a5c66fbdd63816794dc1f23b41ec98d3b11af.zip
2004-10-09 Paolo Carlini <pcarlini@suse.de>
* include/std/std_memory.h (__get_temporary_buffer): Don't use INT_MAX, prefer numeric_limits<ptrdiff_t>::max(), ok on 64-bit platforms too. * testsuite/20_util/memory/auto_ptr/assign_neg.cc: Adjust dg-error line numbers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88814 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std/std_memory.h')
-rw-r--r--libstdc++-v3/include/std/std_memory.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/libstdc++-v3/include/std/std_memory.h b/libstdc++-v3/include/std/std_memory.h
index 4e6641ef673..1d278e6cb86 100644
--- a/libstdc++-v3/include/std/std_memory.h
+++ b/libstdc++-v3/include/std/std_memory.h
@@ -58,6 +58,7 @@
#include <bits/stl_uninitialized.h>
#include <bits/stl_raw_storage_iter.h>
#include <debug/debug.h>
+#include <limits>
namespace std
{
@@ -73,8 +74,9 @@ namespace std
pair<_Tp*, ptrdiff_t>
__get_temporary_buffer(ptrdiff_t __len, _Tp*)
{
- if (__len > ptrdiff_t(INT_MAX / sizeof(_Tp)))
- __len = INT_MAX / sizeof(_Tp);
+ const ptrdiff_t __max = numeric_limits<ptrdiff_t>::max() / sizeof(_Tp);
+ if (__len > __max)
+ __len = __max;
while (__len > 0)
{
@@ -105,7 +107,7 @@ namespace std
* Provides the nothrow exception guarantee.
*/
template<typename _Tp>
- inline pair<_Tp*,ptrdiff_t>
+ inline pair<_Tp*, ptrdiff_t>
get_temporary_buffer(ptrdiff_t __len)
{ return std::__get_temporary_buffer(__len, static_cast<_Tp*>(0)); }
OpenPOWER on IntegriCloud