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

C macro exposed in interface #127

Open
jeanlucf22 opened this issue Nov 1, 2022 · 6 comments
Open

C macro exposed in interface #127

jeanlucf22 opened this issue Nov 1, 2022 · 6 comments

Comments

@jeanlucf22
Copy link
Contributor

utils_dist.h is included in superlu_defs.h, and thus exposes the following definition of EMPTY in the public interface:

#define EMPTY (-1)

This can cause a naming conflict when this include file is included ahead of another one using the same string "EMPTY". I just experienced that conflict with a CUDA header. I am able to avoid this issue by including the superlu header files after the CUDA ones in my code, but it would be better practice if that EMPTY string was never exposed in the public interface (I don't think it needs to). It may save some headaches to future users.

@jhux2
Copy link

jhux2 commented May 1, 2023

This has also been reported by a Trilinos user in trilinos/Trilinos#11839.

@xiaoyeli
Copy link
Owner

xiaoyeli commented May 3, 2023

I just pushed a commit in master, renamed all EMPTY by SLU_EMPTY.

@jeanlucf22
Copy link
Contributor Author

That should help. Thanks!

@jhux2
Copy link

jhux2 commented May 5, 2023

@xiaoyeli Thank you! Btw, I noticed in the same file that the constants TRUE and FALSE might cause clashes with other packages.

#define SLU_EMPTY (-1)
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (1)
#endif

@haampie
Copy link

haampie commented Oct 30, 2023

Could you please prefix the other defines that are in public headers too @xiaoyeli?

@xiaoyeli
Copy link
Owner

xiaoyeli commented Nov 1, 2023

There are lots of places using FALSE/TRUE; changing it will affect many files.
I would think any other packages would define FALSE to be 0, should not cause conflict.

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

No branches or pull requests

4 participants