[Bug c++/60959] New:=?UTF-8?Q?=20Does=20=E2=80=9Ccout?=<<(char*)=?UTF-8?Q?NULL=E2=80=9D=20doing=20=E2=80=9Cclose?=(1)=?UTF-8?Q?=E2=80=9D=20?=?

sree.gooogle at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Apr 25 02:44:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60959

            Bug ID: 60959
           Summary: Does “cout<<(char*)NULL” doing “close(1)” ?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sree.gooogle at gmail dot com

In the following piece of C++ code I have used cout<<(char*)NULL; after this
line, my program printing nothing to the output screen. Does it mean I have
done close(1) with cout here?

#include<iostream>
using namespace std;

void f(){
    cout<<"\nfun\n";
}

main(){
cout<<(char*)NULL;
f(); //not getting printed !
cout<<"\nhello\n";  //not getting printed !
cout<<"hii how are you?"; //not getting printed, why??
}

compiled using:
g++ myprog.cpp
run:
./a.out

o/p:
 Prints nothing

I have tried this code in gcc as well as DevCpp compiler, same behavior
observed. Is this a compiler bug? Please provide detailed information about
this behavior. 

Thank you!


More information about the Gcc-bugs mailing list