Skip to content

#ifndef blocks confusion? #13

@AlexMitchellMus

Description

@AlexMitchellMus

Fantastic small lib! However I am a bit confused as to what exactly the defines are intended to do.

If we don't define ROCKET_NO_EXCEPTIONS Then it gets defined anyway?

#ifndef ROCKET_NO_EXCEPTIONS
#    define ROCKET_NO_EXCEPTIONS
#endif

Then here, if it's not defined, we include std::exception?

#ifndef ROCKET_NO_EXCEPTIONS
#    include <exception>
#endif

So when we get here, it's always defined?

#ifndef ROCKET_NO_EXCEPTIONS
    struct error : std::exception
    {
    };

    struct bad_optional_access final : error
    {
        const char* what() const noexcept override
        {
            return "rocket: Bad optional access.";
        }
    };

    struct invocation_slot_error final : error
    {
        const char* what() const noexcept override
        {
            return "rocket: One of the slots has raised an exception during the signal invocation.";
        }
    };
#endif

So wouldn't this be the correct interface?

#ifndef ROCKET_ENABLE_EXCEPTIONS
#    define ROCKET_NO_EXCEPTIONS
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions