C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Clarification in 1745

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
Maciej Sobczak
Guest





PostPosted: Wed Feb 02, 2005 5:04 pm    Post subject: Clarification in 1745 Reply with quote



Hi,

In the N1745 document, in the 2.2.3.1/7 and other definitions of the
shared_ptr constructors, there is:

"Throws: bad_alloc, or an implementation-defined exception when a
resource other than memory could not be obtained."


1. What kind of resource *other than memory* may be needed to construct
a shared_ptr object?

1a. Is the use of bad_alloc blessed for reporting failures with
resources other than memory, anyway (see 18.4.2.1/1 in '98 std)?

2. Does it mean that the constructor does *not* throw if it is the
memory that cannot be obtained? What the constructor is supposed to do,
then?


Shouldn't it be instead:

"Throws: bad_alloc, or an implementation-defined exception when a
sufficient resources could not be obtained."

--
Maciej Sobczak : http://www.msobczak.com/
Programming : http://www.msobczak.com/prog/

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]

Back to top
msalters
Guest





PostPosted: Wed Feb 02, 2005 7:06 pm    Post subject: Re: Clarification in 1745 Reply with quote




Maciej Sobczak wrote:
Quote:
Hi,

In the N1745 document, in the 2.2.3.1/7 and other definitions of the
shared_ptr constructors, there is:

"Throws: bad_alloc, or an implementation-defined exception when a
resource other than memory could not be obtained."


1. What kind of resource *other than memory* may be needed to
construct
a shared_ptr object?

Mutex?

Quote:
1a. Is the use of bad_alloc blessed for reporting failures with
resources other than memory, anyway (see 18.4.2.1/1 in '98 std)?

It's also allowed anywhere UB is encountered, of course.

Quote:
2. Does it mean that the constructor does *not* throw if it is the
memory that cannot be obtained? What the constructor is supposed to
do,
then?

Throw bad_alloc, of course.

Quote:
Shouldn't it be instead:

"Throws: bad_alloc, or an implementation-defined exception when a
sufficient resources could not be obtained."

I think you're misreading it. I'm pretty sure it means
"Throws: bad_alloc when memory could not be obtained, or an
implementation-defined exception when a resource other than
memory could not be obtained." but that's a bit verbose.
HTH,
Michiel Salters

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]


Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.