Hi Daniel,
>>Now if the implementation file is compiled without debug, but a certain
>>client file of the header is compiled with debug=1 (resulting in
>>OSL_DEBUG_LEVEL > 0), will this client file crash, or are the debug- and
>>non-debug "versions" of DebugBase binary compatible?
>
> DebugBase is an empty class in both cases, I expect this to work (never
> tested!). But I would avoid such scenarios, because it violates the One
> Defintion Rule (ODR). Nobody can garantee this works on all compilers.
Why does this violate the ODR? Not sure if I made my case clear ... assume:
class Foo : public DebugBase< Foo >
{
private:
int m_foo;
public:
inline int getFoo() const { return m_foo; }
};
If one client of this class would be compiled with and one without
debug, and DebugBase would add a member, then one client would probably
create an access violation (or simply get nonsense) upon calling getFoo().
Where's the violation of the ODR here?
>>Sorry for being that inquisitive :)
>
> BTW: We've had discussion about this last year:
> <http://www.openoffice.org/servlets/ReadMsg?list=dev&msgNo=15366>
> DebugBase has been the outcome.
I remember this discussion, I just missed interesting details in the
announcement :)
My question for the OSL_DEBUG_LEVEL is because in the past, I've been
bit by problems similar to the one described above. Usually, I don't
think making such diagnostics depend on OSL_DEBUG_LEVEL is a good idea -
I prefer DBG_UTIL, since here you *cannot* compile different files with
different switches. DBG_UTIL is either ON or OFF, globally, while
OSL_DEBUG_LEVEL might be different for different files.
(yes, there's a certain OSL_DEBUG_LEVEL which matches to DBG_UTIL, but I
never can remeber this unintuitive setting: Does DBG_UTIL mean
OSL_DEBUG_LEVEL = 2? Or does debug=1 imply this, and DBG_UTIL is just
adding one more? Don't know ...)
Ciao
Frank
--
- Frank Schönheit, Software Engineer [EMAIL PROTECTED] -
- Sun Microsystems http://www.sun.com/staroffice -
- OpenOffice.org Database http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]