<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">
<div class="moz-cite-prefix">On 24-Dec-15 19:46, Magnus Therning
wrote:<br>
</div>
<blockquote cite="mid:871tac10bz.fsf@therning.org" type="cite">
<pre wrap="">I'm *not* mixing stuff built with `-g` and stuff built without it.</pre>
</blockquote>
Actually I don't see anything bad about mixing `-g` code with code
without `-g`.<br>
<br>
<blockquote cite="mid:871tac10bz.fsf@therning.org" type="cite">
<pre wrap=""> I'm
also *not* mixing linking with debug- and non-debug libraries.</pre>
</blockquote>
Since we cover a lot of aspects please specify what you mean by
debug and non-debug libraries.<br>
<br>
<blockquote cite="mid:871tac10bz.fsf@therning.org" type="cite">
<pre wrap="">I'm only mixing stuff build with `-DNDEBUG` and stuff built without it.</pre>
</blockquote>
see below<br>
<br>
On 24-Dec-15 19:48, Magnus Therning wrote:<br>
</div>
<blockquote cite="mid:87zix0yptw.fsf@therning.org" type="cite">
<pre wrap="">
Ruslan Baratov writes:
</pre>
<blockquote type="cite">
<pre wrap="">On 22-Dec-15 04:07, Magnus Therning wrote:
</pre>
<pre wrap="">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:
<a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/20833226/library-headers-and-define">http://stackoverflow.com/questions/20833226/library-headers-and-define</a>
</pre>
</blockquote>
<pre wrap="">
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.</pre>
</blockquote>
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.<i></i><br>
<br>
<blockquote cite="mid:87zix0yptw.fsf@therning.org" type="cite">
<pre wrap="">If I'm reading you correctly you are advocating I simply get rid of the
use of those asserts altogether instead.
</pre>
</blockquote>
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.<br>
<br>
Ruslo<br>
</body>
</html>