Opened 9 years ago

Closed 9 years ago

#250 closed defect (duplicate)

are Element::create() variants exception free?

Reported by: jinmei Owned by: jelte
Priority: medium Milestone: 05. 3rd Incremental Release: Serious Secondary
Component: message-library Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity:
Sub-Project: Feature Depending on Ticket:
Estimated Difficulty: Add Hours to Ticket:
Total Hours: Internal?:

Description

The documentation states:

    /// \name Direct factory functions
    /// \brief These functions simply wrap the given data directly
    /// in an Element object, and return a reference to it, in the form
    /// of an \c ElementPtr.
    /// If there is a memory allocation problem, these functions will
    /// return a NULL ElementPtr, which can be checked with
    /// Element::is_null(ElementPtr ep).
    //@{
    static ElementPtr create(const int i);
    ...

But the actual code doesn't seem to handle allocation failure:

ElementPtr
Element::create(const int i) {
    return ElementPtr(new IntElement(i));
}
...

Am I missing something? Or does either the doc or the implementation need to be fixed?

I'm giving this to Jelte because I believe he should know this stuff best.

Subtickets

Change History (1)

comment:1 Changed 9 years ago by jelte

  • Resolution set to duplicate
  • Status changed from new to closed

No, you are right. This part of the documentation is missing. No avoid reintroducing this specific one, I didn't create a separate branch for this, but added it to ticket #172 (it has the other change regarding exceptions in this factory function too).

Barring a 'added to other ticket' resolve status, I'm marking this as duplicate, which isn't exactly right, but as close as it gets. So please refer to #172 for any followups.

Note: See TracTickets for help on using tickets.