This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cerr and NULL terminates program + string::find() weird results


Hi there,

I'm using g++ 3.1.1 and the STL that came with it (libstdc++.so.4.0.1) under
redhat 6.2.

I have one weird thing happening. Look at the following code:

#include <iostream>
int
  main()
{
    const char* const c1 = "C1";
    const char* const c2 = "C2";
    const char* const d  = NULL;
    const char* const c3 = "C3";

    std::cerr << "c1 is " << c1 << std::endl;
    std::cerr << "c2 is " << c2 << std::endl;
    std::cerr << "d  is " << d << std::endl;
    std::cerr << "c3 is " << c3 << std::endl;
    return 0;
}

the output is:

c1 is C1
c2 is C2
d  is [root@anibal /tmp]#

So, as you see the program misteriously terminates when trying to cerr a
NULL const char*.

Any pointers will be greatly appreciated,

-Anibal



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]