Right!
too many years writing bad code...
I think in 1 of my CS courses 4 years ago they mentioned namespaces, for 
about 20 seconds, and then said "but they don't really matter, you don't 
need them"
so much for college being the end all be all of knowledge attainment.


>From: Brian Ashe <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: Re: c++ errors...
>Date: Wed, 9 Oct 2002 09:53:17 -0400
>
>Christensen Tom,
>
>On Wednesday October 09, 2002 03:19, Christensen Tom wrote:
> > Ok,
> > I've been using Linux for about 1 year now, and 1 thing that has always
> > worked right out of the box is the gcc compiler... until now.
> > installed redhat 8.0 and it won't compile c++ programs...
> > not even hello world
> >
> > #include <iostream>
> >
> > int main()  {
> >   cout << "Hello World\n";
> >   return 0;
> > }
> >
> > when I compile that it says "undeclared function cout".
> > if I include iostream.h, it compiles successfully but complains because
> > iostream.h is deprecated.  What gives? why's it broken? I've got 
>iostream
> > in my usr/include/c++/3.2 directory it should work, but it doesn't.
>
>It's not broken, it's been fixed. ;)
>
>The 3.2 version of GCC is VERY standards compliant and requires you to be 
>as
>well. This especially means that namespaces are very important. This is a
>frequently overlooked part of the standard and means there is a ton of
>"broken" code, including the snippet above.
>
>You have two choices that will stop all your errors (and give you better
>code)...
>
>Sample 1 :
>#include <iostream>
>
>using namespace std;
>
>int main ()
>{
>   cout << "Hello World\n";
>
>   return 0;
>}
>
>or Sample 2 :
>#include <iostream>
>
>int main ()
>{
>   std::cout << "Hello World\n";
>
>   return 0;
>}
>
>When to use which is up to your needs.
>
>--
>Brian Ashe                                                     CTO
>Dee-Web Software Services, LLC.                  [EMAIL PROTECTED]
>
>
>
>--
>redhat-list mailing list
>unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
>https://listman.redhat.com/mailman/listinfo/redhat-list




_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to