Open msoos opened 3 years ago
What is the do while for?
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 :)
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 ?
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
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 underRelWithDebInfo
build config in cmake, it adds the-DNDEBUG
. I need to use aDebug
build that, but that's very slow. I found that thisrelease_assert
helps in such cases.