On 24-Dec-15 19:46, Magnus Therning wrote:
I'm *not* mixing stuff built with `-g` and stuff built without it.
Actually I don't see anything bad about mixing `-g` code with code without `-g`.

   I'm
also *not* mixing linking with debug- and non-debug libraries.
Since we cover a lot of aspects please specify what you mean by debug and non-debug libraries.

I'm only mixing stuff build with `-DNDEBUG` and stuff built without it.
see below

On 24-Dec-15 19:48, Magnus Therning wrote:
Ruslan Baratov writes:

On 22-Dec-15 04:07, Magnus Therning wrote:

It is possible to hit situation when ODR will be violated, e.g. if
somebody define optional member in structure with "#if defined(NDEBUG)"
condition. Something like this:
http://stackoverflow.com/questions/20833226/library-headers-and-define
Yes, if we ever start using the NDEBUG macro to control anything in our
code then I'll have to worry about this, as it stands right now it's
only the `assert` from `assert.h` that cares about it.
Even if you care only about `assert` somebody can define different type of structures based on value of NDEBUG. I'm talking about 3rd party library that you can use and you can't control. If this will lead to ODR violation then bug is NOT in 3rd party code, but in YOUR code. That's my point. You can mix c++11 with c++98, libc++ with libstdc++, mingw with cygwin, mingw with Visual Studio, NDEBUG with non NDEBUG, and it MAY works, but when something suddenly will stop working with very obscure errors that it's YOUR fault and not 3rd party.//

If I'm reading you correctly you are advocating I simply get rid of the
use of those asserts altogether instead.
I'm not sure what you mean. I'm just telling that if you want do some runtime checks even when NDEBUG is OFF then you should introduce your own macro FOO_DEBUG. Difference is about global/local affects.

Ruslo
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to