/******************************************************************************/ /* */ /* FILE: november.cpp */ /* */ /* The STL way to print "Hello world !" */ /* ==================================== */ /* */ /* Compiled and tested with Visual C++ V6.0 */ /* */ /* V1.00 22-NOV-2000 P. Tellenbach http://www.heimetli.ch/ */ /* */ /******************************************************************************/ #include <iostream> #include <iterator> std::ostream_iterator< char * > hello( std::cout, " world !\n" ) ; int main( ) { return &( hello = "Hello" ) == 0 ; }
Update 22. November 2020
The compiler prints a warning, but the program still runs. Converting the argument to const char * corrected the problem.
/******************************************************************************/ /* */ /* FILE: november.cpp */ /* */ /* The STL way to print "Hello world !" */ /* ==================================== */ /* */ /* Compiled and tested with Visual C++ V6.0 */ /* */ /* V1.00 22-NOV-2000 P. Tellenbach https://www.heimetli.ch/ */ /* */ /* Compiled and tested with g++ V8.3.0 */ /* */ /* V2.00 22-NOV-2020 P. Tellenbach https://www.heimetli.ch/ */ /* */ /******************************************************************************/ #include <iostream> #include <iterator> std::ostream_iterator< const char * > hello( std::cout, " world !\n" ) ; int main( ) { return &( hello = "Hello" ) == 0 ; }