473,480 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

[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;
}
Nov 10 '06 #1
13 1611
On Fri, 10 Nov 2006 19:31:05 GMT in comp.lang.c++, Howard Hinnant
<ho************@gmail.comwrote,
>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

Nov 10 '06 #2
On Fri, 10 Nov 2006 19:31:05 GMT in comp.lang.c++, Howard Hinnant
<ho************@gmail.comwrote,
>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
Nov 10 '06 #3
Howard Hinnant wrote:
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
Nov 10 '06 #4
In article <45***************@news.west.earthlink.net>, David Harmon
says...
On Fri, 10 Nov 2006 19:31:05 GMT in comp.lang.c++, Howard Hinnant
<ho************@gmail.comwrote,
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
Nov 10 '06 #5
On Fri, 10 Nov 2006 21:11:28 GMT in comp.lang.c++, Alexey Sarytchev
<al***@hotmail.comwrote,
>$ 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.

Nov 10 '06 #6
In article
<ho**********************************@syrcnyrdrs-02-ge0.nyroc.rr.com>,
Howard Hinnant <ho************@gmail.comwrote:
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.
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
Nov 11 '06 #7
VJ
Howard Hinnant wrote:
>
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)
Nov 13 '06 #8
David Harmon wrote:
On Fri, 10 Nov 2006 21:11:28 GMT in comp.lang.c++, Alexey Sarytchev
<al***@hotmail.comwrote,
>$ 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
Nov 13 '06 #9
On Fri, 10 Nov 2006 20:34:30 GMT, David Harmon wrote:
>On Fri, 10 Nov 2006 19:31:05 GMT in comp.lang.c++, Howard Hinnant
wrote,
>>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
Nov 13 '06 #10
Alexey Sarytchev wrote:
David Harmon wrote:
>On Fri, 10 Nov 2006 21:11:28 GMT in comp.lang.c++, Alexey Sarytchev
<al***@hotmail.comwrote,
>>$ 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
Nov 13 '06 #11
David Harmon <so****@netcom.comwrote:
On Fri, 10 Nov 2006 19:31:05 GMT in comp.lang.c++, Howard Hinnant
<ho************@gmail.comwrote,
>>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
Nov 13 '06 #12
In article <ej**********@news-int2.gatech.edu>,
ri******@gehennom.invalid (Marcus Kwok) wrote:
David Harmon <so****@netcom.comwrote:
On Fri, 10 Nov 2006 19:31:05 GMT in comp.lang.c++, Howard Hinnant
<ho************@gmail.comwrote,
>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
Nov 13 '06 #13
On Mon, 13 Nov 2006 15:26:23 GMT in comp.lang.c++, rp*****@yahoo.com
(Roland Pibinger) wrote,
>>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?

Nov 13 '06 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5683
by: GTF | last post by:
PHP Web Survey Idea.. I have been given an opportunity to create a web based survey. This is a fairly lengthy survey of 60 pages on paper (various multiple choice and free form). These are...
3
2494
by: Howard Hinnant | last post by:
I recently asked for a survey of multimap insert with hint behavior, in support of a paper I'm writing concerning lwg issue 233. My sincere thanks to Beman Dawes, Raoul Gough, Russell Hind, Bronek...
5
4097
by: DFS | last post by:
I've written several survey systems in which the majority of the questions have the same or similar responses (Yes/No, True/False, scale of 1 - 5, etc). But this latest survey system I'm working...
1
1980
by: Nico Baumgarten | last post by:
Dear Madam/Sir, You are invited to participate in an international research study. This research project is headed and led by Cambridge student Nico Baumgarten. What is it all about? It is a...
3
6307
by: Yurk Yurk | last post by:
I need to create a database or something that will allow me to input all of the results of a survey and then search the results for trends and stuff. For example, it might have questions like: ...
2
1742
by: Matt | last post by:
Hi everyone, Constructed a fairly big table with 20 rows, most of which are TINYINTs based on user selection for a dropdown box. This is the form: http://www.threechords.org/spb/survey/ ...
0
2071
by: Janet93 | last post by:
If you are involved in the development of scientific computing software, you are invited to participate in a survey on developing this kind of software. If you have already received this request, I...
0
7046
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7048
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7088
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4783
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
2997
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2986
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.