
November 10th, 2006, 07:15 PM
| | | [survey] LWG issue 206
Hello,
I'm writing a brief paper on LWG issue 206: http://www.open-std.org/jtc1/sc22/wg...ctive.html#206
It would help me immensely if I knew more about the current practice of
several vendors. I am asking for volunteers to post the results of the
following short program, along with the compiler (including version)
which produced those results. To get the ball rolling, here are results
I'm aware of:
CodeWarrior Pro 7-10:
custom allocation
custom deallocation
custom allocation
custom deallocation
gcc 4.0.1 on Mac OS X*:
custom allocation
custom deallocation
custom allocation
custom deallocation
* For the above results on gcc/Mac I had to add the following line to
the program which concerns a side issue I'm not addressing herein:
__attribute__((__weak__, __visibility__("default"))) int
dummy_weak_symbol_for_new;
Below is the test. Thank you in advance.
Howard Hinnant
----------------
#include <cstdio>
#include <cstdlib>
#include <new>
void* operator new(std::size_t size) throw(std::bad_alloc)
{
std::printf("custom allocation\n");
if (size == 0)
size = 1;
void*p = std::malloc(size);
if (p == 0)
throw std::bad_alloc();
return p;
}
void operator delete(void* ptr) throw()
{
std::printf("custom deallocation\n");
std::free(ptr);
}
int main()
{
int* i = new int;
delete i;
int* a = new int[3];
delete [] a;
} | 
November 10th, 2006, 08:05 PM
| | | Re: [survey] LWG issue 206
On Fri, 10 Nov 2006 19:31:05 GMT in comp.lang.c++, Howard Hinnant
<howard.hinnant@gmail.comwrote, Quote:
>I am asking for volunteers to post the results of the
>following short program, along with the compiler (including version)
>which produced those results.
| C:\USR\temp>cl /EHsc h.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for
80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
h.cpp
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
/out:h.exe
h.obj
C:\USR\temp>h
custom allocation
custom deallocation
custom allocation
custom deallocation | 
November 10th, 2006, 08:15 PM
| | | Re: [survey] LWG issue 206
On Fri, 10 Nov 2006 19:31:05 GMT in comp.lang.c++, Howard Hinnant
<howard.hinnant@gmail.comwrote, Quote:
>I am asking for volunteers to post the results of the
>following short program, along with the compiler (including version)
>which produced those results.
| C:\USR\temp>dmc
Digital Mars Compiler Version 8.38n
Copyright (C) Digital Mars 2000-2003. All Rights Reserved.
Written by Walter Bright www.digitalmars.com
C:\USR\temp>dmc -Ae h.cpp
{
^
h.cpp(6) : Error: Exception specifications must match exactly for each
declaration of a function
{
^
h.cpp(17) : Error: Exception specifications must match exactly for each
declaration of a function
--- errorlevel 1
After changing those lines to respectively:
void* operator new(std::size_t size) // throw(std::bad_alloc)
void operator delete(void* ptr) // throw()
C:\USR\temp>dmc -Ae h.cpp
link h,,,user32+kernel32/noi;
C:\USR\temp>h
custom allocation
custom deallocation
custom deallocation | 
November 10th, 2006, 08:55 PM
| | | Re: [survey] LWG issue 206
Howard Hinnant wrote: Quote:
Hello,
>
I'm writing a brief paper on LWG issue 206:
> http://www.open-std.org/jtc1/sc22/wg...ctive.html#206
>
It would help me immensely if I knew more about the current practice of
several vendors. I am asking for volunteers to post the results of the
following short program, along with the compiler (including version)
which produced those results. To get the ball rolling, here are results
| IBM VisualAge C++ 7.0 on AIX 5.3:
$ xlC qq.cpp
$ ./a.out
custom allocation
custom deallocation
HP ANSI C++ B3910B A.03.56 on HP-UX 11.11 (PARISC)
$ aCC -AA qq.cpp
$ ./a.out
custom allocation
custom deallocation
HP aC++/ANSI C B3910B A.06.00 [Aug 25 2004] on HP-UX 11.23 (Itanium)
$ aCC -AA qq.cpp && ./a.out
custom allocation
custom allocation
custom deallocation
Sun C++ 5.8 2005/10/13 on Solaris 8 (SPARC)
$ CC qq.cpp && ./a.out
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom deallocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom deallocation
custom allocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom allocation
custom allocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom allocation
custom allocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom allocation
custom allocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom allocation
custom allocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom allocation
custom allocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom allocation
custom allocation
custom deallocation
custom deallocation
custom deallocation
GCC 4.0.2 on Solaris 8 (SPARC)
$ g++ qq.cpp && ./a.out
custom allocation
custom deallocation
custom allocation
custom deallocation
$ CC -V
CC: Forte Developer 7 C++ 5.4 2002/03/09 on Solaris 9 (SPARC)
$ CC qq.cpp && ./a.out
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom deallocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom deallocation
custom allocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
GCC 3.4.3 on Solaris 9 (SPARC)
$ g++ qq.cpp && ./a.out
custom allocation
custom deallocation
custom allocation
custom deallocation
GCC 3.4.0 on RedHat Enterprise Linux AS release 3
$ g++ qq.cpp && ./a.out
custom allocation
custom deallocation
custom allocation
custom deallocation
Regards,
Alexey Sarytchev | 
November 10th, 2006, 10:05 PM
| | | Re: [survey] LWG issue 206
In article <4567e0d3.50333906@news.west.earthlink.net>, David Harmon
says... Quote:
On Fri, 10 Nov 2006 19:31:05 GMT in comp.lang.c++, Howard Hinnant
<howard.hinnant@gmail.comwrote, Quote:
I am asking for volunteers to post the results of the
following short program, along with the compiler (including version)
which produced those results.
| >
C:\USR\temp>dmc
Digital Mars Compiler Version 8.38n
Copyright (C) Digital Mars 2000-2003. All Rights Reserved.
Written by Walter Bright www.digitalmars.com | g++ (GCC) 3.4.5 (mingw special)
custom allocation
custom deallocation
custom allocation
custom deallocation | 
November 10th, 2006, 10:45 PM
| | | Re: [survey] LWG issue 206
On Fri, 10 Nov 2006 21:11:28 GMT in comp.lang.c++, Alexey Sarytchev
<alx_s@hotmail.comwrote, Quote:
>$ CC qq.cpp && ./a.out
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
| ....
Awesome. Perhaps you would add
cout << "Begin\n";
and
cout << "\End\n";
in main() for clarification. | 
November 11th, 2006, 06:05 PM
| | | Re: [survey] LWG issue 206
In article
<howard.hinnant-F0F240.14310510112006@syrcnyrdrs-02-ge0.nyroc.rr.com>,
Howard Hinnant <howard.hinnant@gmail.comwrote: Thanks to those who helped in the survey. If anyone has more data to
add (not already included in the paper), I will gladly accept it.
I've put the current draft of the paper up at: http://home.twcny.rr.com/hinnant/cpp.../issue206.html
Comments, critiques on the paper are also welcome.
Thanks,
Howard | 
November 13th, 2006, 10:05 AM
| | | Re: [survey] LWG issue 206
Howard Hinnant wrote: Quote:
>
CodeWarrior Pro 7-10:
>
custom allocation
custom deallocation
custom allocation
custom deallocation
>
gcc 4.0.1 on Mac OS X*:
>
custom allocation
custom deallocation
custom allocation
custom deallocation
>
* For the above results on gcc/Mac I had to add the following line to
the program which concerns a side issue I'm not addressing herein:
>
__attribute__((__weak__, __visibility__("default"))) int
dummy_weak_symbol_for_new;
>
Below is the test. Thank you in advance.
>
|
custom allocation
custom deallocation
custom allocation
custom deallocation
gcc version 4.0.2 20051125 (Red Hat 4.0.2-8) | 
November 13th, 2006, 02:45 PM
| | | Re: [survey] LWG issue 206
David Harmon wrote: Quote:
On Fri, 10 Nov 2006 21:11:28 GMT in comp.lang.c++, Alexey Sarytchev
<alx_s@hotmail.comwrote, Quote:
>$ CC qq.cpp && ./a.out
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
>custom allocation
| ...
>
Awesome. Perhaps you would add
cout << "Begin\n";
and
cout << "\End\n";
in main() for clarification.
>
| $ CC -V
CC: Sun C++ 5.8 2005/10/13
$ CC qq.cpp && ./a.out
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom deallocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
Begin
custom allocation
custom deallocation
custom allocation
custom deallocation
End
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom allocation
custom allocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom allocation
custom allocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom allocation
custom allocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom allocation
custom allocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom allocation
custom allocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom deallocation
custom allocation
custom allocation
custom deallocation
custom deallocation
custom deallocation
$
for the next program:
================ cut =====================
#include <cstdio>
#include <cstdlib>
#include <new>
#include <iostream>
using namespace std;
void* operator new(std::size_t size) throw(std::bad_alloc)
{
std::printf("custom allocation\n");
if (size == 0)
size = 1;
void*p = std::malloc(size);
if (p == 0)
throw std::bad_alloc();
return p;
}
void operator delete(void* ptr) throw()
{
std::printf("custom deallocation\n");
std::free(ptr);
}
int main()
{
cout << "Begin\n";
int* i = new int;
delete i;
int* a = new int[3];
delete [] a;
cout << "End\n";
}
================ cut =====================
Regards,
Alexey Sarytchev | 
November 13th, 2006, 03:05 PM
| | | Re: [survey] LWG issue 206
On Fri, 10 Nov 2006 20:34:30 GMT, David Harmon wrote: Quote:
>On Fri, 10 Nov 2006 19:31:05 GMT in comp.lang.c++, Howard Hinnant
>wrote, Quote:
>>I am asking for volunteers to post the results of the
>>following short program, along with the compiler (including version)
>>which produced those results.
| >
>C:\USR\temp>dmc
>Digital Mars Compiler Version 8.38n
>Copyright (C) Digital Mars 2000-2003. All Rights Reserved.
>Written by Walter Bright www.digitalmars.com
>
>C:\USR\temp>dmc -Ae h.cpp
>{
>^
>h.cpp(6) : Error: Exception specifications must match exactly for each
>declaration of a function
>{
>^
>h.cpp(17) : Error: Exception specifications must match exactly for each
>declaration of a function
>--- errorlevel 1
>
>After changing those lines to respectively:
>void* operator new(std::size_t size) // throw(std::bad_alloc)
>void operator delete(void* ptr) // throw()
| Why not just #include the necessary file?
Best wishes,
Roland Pibinger | 
November 13th, 2006, 06:15 PM
| | | Re: [survey] LWG issue 206
Alexey Sarytchev wrote: Quote:
David Harmon wrote: Quote:
>On Fri, 10 Nov 2006 21:11:28 GMT in comp.lang.c++, Alexey Sarytchev
><alx_s@hotmail.comwrote, Quote:
>>$ CC qq.cpp && ./a.out
>>custom allocation
>>custom allocation
>>custom allocation
>>custom allocation
>>custom allocation
>>custom allocation
>>custom allocation
>>custom allocation
>>custom allocation
>>custom allocation
>>custom allocation
>>custom allocation
>>custom allocation
| >...
>>
>Awesome. Perhaps you would add
> cout << "Begin\n";
>and cout << "\End\n";
>in main() for clarification.
| | I think you will like this:
$ aCC -V
aCC: HP aC++/ANSI C B3910B A.06.00 [Aug 25 2004]
$ aCC -AA qq.cpp && ./a.out
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom deallocation
custom allocation
custom allocation
Begin
custom allocation
custom deallocation
End
$ aCC -V
aCC: HP ANSI C++ B3910B A.03.56
$ aCC -AA qq.cpp && ./a.out
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom allocation
custom deallocation
custom allocation
custom allocation
Begin
custom allocation
custom deallocation
End
Regards,
Alexey Sarytchev | 
November 13th, 2006, 08:35 PM
| | | Re: [survey] LWG issue 206
David Harmon <source@netcom.comwrote: Quote:
On Fri, 10 Nov 2006 19:31:05 GMT in comp.lang.c++, Howard Hinnant
<howard.hinnant@gmail.comwrote, Quote:
>>I am asking for volunteers to post the results of the
>>following short program, along with the compiler (including version)
>>which produced those results.
| >
C:\USR\temp>cl /EHsc h.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for
80x86
>
custom allocation
custom deallocation
custom allocation
custom deallocation
| For what it's worth, I get the same results with
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.6030 for 80x86
which is the Visual Studio .NET 2003 compiler with SP1 applied, and a
stricter set of compile options in terms of standards-compliance
(thought most of them shouldn't affect this example):
(cl /EHsc /Zc:forScope,wchar_t /GR /Za /Op- hh.cpp)
--
Marcus Kwok
Replace 'invalid' with 'net' to reply | 
November 13th, 2006, 08:55 PM
| | | Re: [survey] LWG issue 206
In article <ejalt0$g29$1@news-int2.gatech.edu>, ricecake@gehennom.invalid (Marcus Kwok) wrote: Quote:
David Harmon <source@netcom.comwrote: Quote:
On Fri, 10 Nov 2006 19:31:05 GMT in comp.lang.c++, Howard Hinnant
<howard.hinnant@gmail.comwrote, Quote:
>I am asking for volunteers to post the results of the
>following short program, along with the compiler (including version)
>which produced those results.
| C:\USR\temp>cl /EHsc h.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for
80x86
custom allocation
custom deallocation
custom allocation
custom deallocation
| >
For what it's worth, I get the same results with
>
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.6030 for 80x86
>
which is the Visual Studio .NET 2003 compiler with SP1 applied, and a
stricter set of compile options in terms of standards-compliance
(thought most of them shouldn't affect this example):
(cl /EHsc /Zc:forScope,wchar_t /GR /Za /Op- hh.cpp)
|
Thanks, I've changed my reference to:
* Microsoft Visual Studio, all recent versions http://home.twcny.rr.com/hinnant/cpp.../issue206.html
If anyone discovers this is not an accurate characterization, please
make some noise.
-Howard | 
November 13th, 2006, 09:05 PM
| | | Re: [survey] LWG issue 206
On Mon, 13 Nov 2006 15:26:23 GMT in comp.lang.c++, rpbg123@yahoo.com
(Roland Pibinger) wrote, Quote: Quote:
>>After changing those lines to respectively:
>>void* operator new(std::size_t size) // throw(std::bad_alloc)
>>void operator delete(void* ptr) // throw()
| >
>Why not just #include the necessary file?
| Which file would that be? |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over network members.
|