nicolasprevot / GpuShareSat

Source code for GpuShareSat, a library for SAT solvers to use the GPU for clause sharing between CPU threads.
Other
32 stars 1 forks source link

Adding release assert against this potential bug #11

Open msoos opened 3 years ago

msoos commented 3 years ago

This add a release assert so we can catch some obvious bugs. I needed this to debug. Unfortunately assert() doesn't work with the nvcc compiler under RelWithDebInfo build config in cmake, it adds the -DNDEBUG. I need to use a Debug build that, but that's very slow. I found that this release_assert helps in such cases.

nicolasprevot commented 3 years ago

What is the do while for?

msoos commented 3 years ago

Hey! Good question, actually, and I was just as surprised as you! This page explains it quite well, I think :) It's due to the C++ macro expansion stuff that was designed in the 80s :)

nicolasprevot commented 3 years ago

I think it would be better to use a do { } while (0, 0) with a comment that visual studio gives a warning for a do { } while (0), it would be much more consise It's also not clear to me why we can't use just skip the do and the while, and just have the { ... } (there's some more code where I use that), are you aware of a compiler where it doesn't work ?

nicolasprevot commented 3 years ago

Actually: I think we don't need the do while or the {} anyway, because currently, inside it, there's the if which mean that it's not separate statements like described on http://bruceblinn.com/linuxinfo/DoWhile.html