Skip to content

The use of "return true ? <object> : <exception>" syntax in code #6

@adleret221

Description

@adleret221

I was wondering as to the nature of the syntax appearing many times in your code, with the use of the ternary operator, for example:
return true ? detail::md5::md5(s) : throw err::md5_runtime_error;

What is the benefit of this? why not just return detail::md5::md5(s)?
After all, to my understanding, the exception will never be evaluated at runtime. Maybe there is some added value to this at compile time? If so, what is it?

thank you in advance.

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