You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
disabled any assert(), placed even in my own code.
I finally noticed that the DEBUG (or -DDEBUG option) stops the definition (apparently). But I think it's better not to define such important macros inside library header files, or the macro leaks into every files which include the header file and users may lose control of assert() in their own code. Moreover, it's dangerous that once users have forgot the -DDEBUG option, every assertion checks would seem like always passed and failures would be hidden.
If there are no other problems, could you stop defining the NDEBUG macro inside the header file?
Thank you for your useful and well-designed library!
mrcdr
The text was updated successfully, but these errors were encountered:
Hi, thanks for pointing this out. I put it into ITensor a long time ago, and had not recently revisted what would be the best practice here.
After thinking through it some, probably the best move for ITensor is to just become agnostic about the whole assert system, including not to use asserts at all in ITensor library code. That way, we won't be forced to define NDEBUG so that we can be sure asserts are definitely turned off within ITensor library code (because the asserts won't exist in the first place).
Appreciate you letting us know about this, because I can see how it's confusing. For now, please set NDEBUG in your own code as you wish, and we will try to get ITensor to be orthogonal to the assert system in the very near future.
Dear developers,
I faced a problem that the
NDEBUG
macro defined here:ITensor/itensor/global.h
Lines 76 to 80 in 9afc9ea
disabled any
assert()
, placed even in my own code.I finally noticed that the
DEBUG
(or-DDEBUG
option) stops the definition (apparently). But I think it's better not to define such important macros inside library header files, or the macro leaks into every files which include the header file and users may lose control ofassert()
in their own code. Moreover, it's dangerous that once users have forgot the-DDEBUG
option, every assertion checks would seem like always passed and failures would be hidden.If there are no other problems, could you stop defining the
NDEBUG
macro inside the header file?Thank you for your useful and well-designed library!
mrcdr
The text was updated successfully, but these errors were encountered: