Skip to content

Exceptions may be thrown from C interface functions #163

Open
@paulapatience

Description

It is undefined behavior to throw exceptions from functions marked extern "C". Yet, createNomadProblem does just this. Probably it should use new(std::nothrow) instead of plain new when creating the NomadProblemInfo, exiting early if the allocation fails, and also catch std::bad_alloc when creating the shared pointer. solveNomadProblem also creates a shared pointer without catching std::bad_alloc.

I have not looked at the NOMAD::AllParameters methods to see if they may throw as well. If they may, then exceptions must be similarly caught.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions