www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - [STLSOft 1.9.44] bug: STLSOFT_MESSAGE_ASSERT doesn't work (anymore)

reply Martin Moene <moene eld.physics.LeidenUniv.nl> writes:
Hi Matthew,

I suspect something has broken the STLSOFT_[MESSAGE_]ASSERT() macro
with visual C++ 6 and 8 (possibly 7 also). See below.

Cheers, Martin.
___

* Test program:

#include <stlsoft/stlsoft.h>
#include <iostream>     // std::cout, std::endl

int main()
{
    std::cerr << "\tBefore STLSOFT_MESSAGE_ASSERT( \"test\", 0 )" << std::endl;

    STLSOFT_MESSAGE_ASSERT( "test", 0 );
    STLSOFT_ASSERT( 0 );

    std::cerr << "\tAfter STLSOFT_MESSAGE_ASSERT( \"test\", 0 )" << std::endl;

    return 0; // keep vc6 happy
}

* Results:

- GCC 3.4.2:
         Before STLSOFT_MESSAGE_ASSERT( "test", 0 )
Assertion failed: ("test" && 0), file bug_vc6-8-stlsoft_message_assert.cpp,
line 8

- VC6, VC8:
         Before STLSOFT_MESSAGE_ASSERT( "test", 0 )
         After STLSOFT_MESSAGE_ASSERT( "test", 0 )

___
Jun 06 2008
parent reply "Matthew Wilson" <matthew hat.stlsoft.dot.org> writes:
Martin

It works fine for me.

What cmd-line params are you specifying? I just did the following:

H:\STLSoft\Releases\1.9\STLSoft\test\scratch\stlsoft\message_assert\vc71>copy
con ..\message_assert.cpp

#include <stlsoft/stlsoft.h>

int main()
{
        STLSOFT_MESSAGE_ASSERT("This message should not be shown", true);
        STLSOFT_MESSAGE_ASSERT("This message should be shown", false);
        return 0;
}
^Z
        1 file(s) copied.

H:\STLSoft\Releases\1.9\STLSoft\test\scratch\stlsoft\message_assert\vc71>cl
-I%STLSOFT%/include -nologo ..\message_assert.cpp &&
message_assert.exe
message_assert.cpp

H:\STLSoft\Releases\1.9\STLSoft\test\scratch\stlsoft\message_assert\vc71>cl
-I%STLSOFT%/include -MLd -D_DEBUG -nologo
..\message_assert.cpp && message_assert.exe
message_assert.cpp

  ** I got the assert dialog here **

H:\STLSoft\Releases\1.9\STLSoft\test\scratch\stlsoft\message_assert\vc71>



Doing the same works for vc6 as well. :-)





"Martin Moene" <moene eld.physics.LeidenUniv.nl> wrote in message
news:4848F4C6.2020604 eld.physics.LeidenUniv.nl...
 Hi Matthew,

 I suspect something has broken the STLSOFT_[MESSAGE_]ASSERT() macro
 with visual C++ 6 and 8 (possibly 7 also). See below.

 Cheers, Martin.
 ___

 * Test program:

 #include <stlsoft/stlsoft.h>
 #include <iostream>     // std::cout, std::endl

 int main()
 {
     std::cerr << "\tBefore STLSOFT_MESSAGE_ASSERT( \"test\", 0 )" << std::endl;

     STLSOFT_MESSAGE_ASSERT( "test", 0 );
     STLSOFT_ASSERT( 0 );

     std::cerr << "\tAfter STLSOFT_MESSAGE_ASSERT( \"test\", 0 )" << std::endl;

     return 0; // keep vc6 happy
 }

 * Results:

 - GCC 3.4.2:
          Before STLSOFT_MESSAGE_ASSERT( "test", 0 )
 Assertion failed: ("test" && 0), file bug_vc6-8-stlsoft_message_assert.cpp,
line 8

 - VC6, VC8:
          Before STLSOFT_MESSAGE_ASSERT( "test", 0 )
          After STLSOFT_MESSAGE_ASSERT( "test", 0 )

 ___

Jun 06 2008
parent Martin Moene <moene eld.physics.LeidenUniv.nl> writes:
Matthew Wilson wrote:
 It works fine for me.
 
 What cmd-line params are you specifying? I just did the following:
 
 <snip>
 
 prompt>cl -I%STLSOFT%/include -nologo ..\message_assert.cpp &&
message_assert.exe
 message_assert.cpp
 
 prompt>cl -I%STLSOFT%/include -MLd -D_DEBUG -nologo ..\message_assert.cpp &&
message_assert.exe
 message_assert.cpp
 
   ** I got the assert dialog here **
 

Matthew, Ok, blush, blush, forgot all about -MLd -D_DEBUG. I used: prompt>cl -I%STLSOFT%/include -nologo message_assert.cpp and prompt>g++ -Wall -I"%STLSOFT%/include" -o message_assert.exe message_assert.cpp I wasn't 'alarmed', because g++'s program gives: Assertion failed: ("This message should be shown" && false), file ..\message_assert.cpp, line 7 While NO -D_DEBUG has been specified. Is this to be expected? Thanks! Martin.
Jun 07 2008