3 ms·
> If it works on Linux to mix debug-enabled objects with "release", what use would it have to make it not work anymore? There is no difference between Linux an
by forrestthewoods 2y ago
> If it works on Linux to mix debug-enabled objects with "release", what use would it have to make it not work anymore?
There is no difference between Linux and Windows here. The debug/release issue is ultimately up to the API developer.
C++ has has the standard template library (STL). libstdc++, libc++, and MSVC STL are three different implementations. STL defines various iterators. A common choice is for a release-mode iterator to be a raw pointer, just 8 bytes on 64-bit. But the debug-mode iterator is a struct with some extra information for runtime validation, so it's 24 bytes!
The end result is that if you pass an iterator to a function that iterator is effectively two completely different types with different memory layouts on debug and release. This is a common issue with C++. Less so with C. But it's not a platform choice per se.
> IUC debug symbols can be totally separated from the object code, such that you can debug the release if you download the debug symbols. A well configured GDB on distros that offer this feature is able to do it automatically for you. It seems very useful and elegant. Why can't Windows do something like this and how is it an advantage?
MSVC always generates separate .pdb files for debug symbols. Windows tooling has spectacular tooling support for symbol servers (download symbols) and source indexing (download source code). It's great.
- o11c 2y agoThe difference is that on Linux, "compile my program in debug mode" does not enable libstdc++'s expensive (and incompatible) mode.
- forrestthewoods 2y agoMy point is the real difference is the implementation of the three libraries. It's not a fundamental platform difference.
- gpderetta 2y agoThe expectation that debug libraries are are compiled with ABI changing flags is, while not fundamental, an significant platform difference. Historically this might be because MSVC didn't even preserve the standard library ABI across versions (although it has done so for the last 10 years at least), so there were little ABI stability expectations.
- jcelerier 2y ago> The difference is that on Linux, "compile my program in debug mode" "Linux" does not have a "compile my program in debug mode" magic toggle (or Release or whatever for what it's worth). Different IDEs and toolchains may have different defaults and expectations. "g++ -g" is not debug mode, it's debug symbols.