Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support STD-like "Throws:" clause #686

Open
akrzemi1 opened this issue Oct 2, 2024 · 8 comments
Open

Support STD-like "Throws:" clause #686

akrzemi1 opened this issue Oct 2, 2024 · 8 comments

Comments

@akrzemi1
Copy link
Contributor

akrzemi1 commented Oct 2, 2024

In the C++ Standard library specification it is customary to say:

Throws: Nothing.

Which means "this function throws nothing if preconditions are satisfied" (otherwise it is free to throw).

And:

Throws: Any exception thrown by the selected constructor of T.

Which makes more sense than a table, in case of function templates.

Can you add support for this? Even if it means a different marker, such as @stdthrows.

@alandefreitas
Copy link
Collaborator

What’s the proposed syntax? It would be a shortcut for something achievable with @throws?

@akrzemi1
Copy link
Contributor Author

akrzemi1 commented Oct 4, 2024

I understand that the present @throws is eager to draw a table of type-description pairs.

I propose something like ordinary text:

/**
  @stdthrows Whatever the selected constructor of `T` throws.
 */

@alandefreitas
Copy link
Collaborator

Mmmm... So https://www.doxygen.nl/manual/commands.html#cmdthrow without the <exception-object>

@akrzemi1
Copy link
Contributor Author

akrzemi1 commented Oct 4, 2024

In a way, yes.

@alandefreitas alandefreitas moved this to In review in MrDocs Oct 7, 2024
@alandefreitas
Copy link
Collaborator

alandefreitas commented Oct 7, 2024

@alandefreitas
Copy link
Collaborator

@alandefreitas
Copy link
Collaborator

Or maybe what we need are shortcuts to https://en.cppreference.com/w/cpp/language/exceptions#Exception_safety

@akrzemi1
Copy link
Contributor Author

akrzemi1 commented Oct 8, 2024

Throws: Any exception thrown by the selected constructor of T.

This is not exception safety.
@par could be a good generic solution, except that it stands for "paragraph", and I think the current layout (template) adds too much sections. For my private use I changed it to render:

Preconditions: x >= 0.
Returns: _val.
Throws: Nothing.

I need the docs to be concise.
And now the word "paragraph" may not fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In review
Development

No branches or pull requests

2 participants