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

Non-consistent exit statuses #51

Open
prj- opened this issue Mar 8, 2022 · 4 comments
Open

Non-consistent exit statuses #51

prj- opened this issue Mar 8, 2022 · 4 comments
Labels
kind: cleanup should be clean kind: wish new feature or enhancement request part: library library usage specific priority: low linked to weak improvements or to a distant deadline

Comments

@prj-
Copy link
Contributor

prj- commented Mar 8, 2022

The exit statuses of functions are non-consistent in the library, e.g., PMMG_Set_meshSize returns 1 on success, while PMMG_bdryUpdate returns PMMG_SUCCESS (defined to 0) on success. Would it be possible to follow the standard and always return 0 (or PMMG_SUCCESS) on success? Otherwise, it makes error checking in calling libraries extremely difficult to handle, see, e.g., https://gitlab.com/petsc/petsc/-/merge_requests/4889#note_863666426, as one needs to jump back and forth between if (return code != 1) // calling-library custom error-handling and if (return code != 0) // calling-library custom error-handling.

@prj-
Copy link
Contributor Author

prj- commented Mar 8, 2022

If you do not plan on addressing this in the near future, could you please generate two parsable lists of functions: the ones that return PMMG_SUCCESS on success and the ones that return 1 on success?

@lcirrottola
Copy link
Contributor

Hello,
I agree that this is ambiguous. The short answer is that internal functions should return 1 on success and 0 on failure, while "high level" functions (those in parmmg.c, libparmmg.cand libparmmg1.c should use exit codes PMMG_SUCCESS, PMMG_LOWFAILURE and PMMG_STRONGFAILURE to differentiate the two failing cases where a mesh can be returned to the user or not. Anyway the two conventions are mixed for functions provided in the API...

This behaviour has been basically inherited from Mmg so I think you will see the same problem in coupling Mmg.

I will see with @Algiane what we can do to make the behaviour more friendly for automatic error checking, either the list you suggest or fixing error codes for the functions provided in libparmmg.h.

@prj-
Copy link
Contributor Author

prj- commented Mar 8, 2022

You are correct, this is « consistent » with Mmg, see MmgTools/mmg#131.

@lcirrottola
Copy link
Contributor

FYI @taupalosaurus

@Algiane Algiane added part: library library usage specific priority: low linked to weak improvements or to a distant deadline kind: cleanup should be clean kind: wish new feature or enhancement request labels Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: cleanup should be clean kind: wish new feature or enhancement request part: library library usage specific priority: low linked to weak improvements or to a distant deadline
Projects
Development

No branches or pull requests

3 participants