Thread: std

  1. #1
    Sir Mister Insane Sako Klinerr1's Avatar
    Join Date
    May 2002
    Posts
    608

    std

    i see
    std::cout

    a lot. is that becaue that dont name

    using namespace std; at the top?
    Email: [email protected] || AIM: MisterSako || MSN: [email protected]

    -the shroom has spoken

  2. #2
    Registered User
    Join Date
    Jun 2002
    Posts
    267
    if it's a small program, declaring a global usage of the std namespace works without problems... but once you get into a complex project, with namespaces of your own, and others, and you've got a million different object scopes, it wont work out so nicely...

    it's just good practice to use std::

    so, just do it now, and later it'll make more sense to you as to why it's good to do it

    but like I said, using namespace std; works you just need to know what it's doing ( :: )

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    267
    hey, where did your dancing Bart go? I liked it!

  4. #4
    flashing vampire black's Avatar
    Join Date
    May 2002
    Posts
    563
    add this line to the top of your code, and you could use cout simply.

    PHP Code:
    #include <iostream> 
    Never end on learning~

  5. #5
    Registered User
    Join Date
    Jun 2002
    Posts
    267
    I think you mean
    PHP Code:
    #include <iostream.h> 

  6. #6
    Registered User Unreg1stered's Avatar
    Join Date
    Jul 2002
    Posts
    25
    <iostream.h> (old version of iostream and it's recornized by old compiler)

    <iostream> (new version and it's unrecornized by old compiler)

  7. #7
    Sir Mister Insane Sako Klinerr1's Avatar
    Join Date
    May 2002
    Posts
    608
    Originally posted by d00b
    hey, where did your dancing Bart go? I liked it!
    i wanted to change my avatar i might put it back.. ooooooooo. u gave me an idea...
    Email: [email protected] || AIM: MisterSako || MSN: [email protected]

    -the shroom has spoken

  8. #8
    Registered User
    Join Date
    Jun 2002
    Posts
    267
    Originally posted by Unreg1stered
    <iostream.h> (old version of iostream and it's recornized by old compiler)

    <iostream> (new version and it's unrecornized by old compiler)
    yup, so if he used <iostream.h> he wouldn't have to worry about namespaces

  9. #9
    Registered User
    Join Date
    Jul 2002
    Posts
    52
    yup, so if he used <iostream.h> he wouldn't have to worry about namespaces
    Instead, he gets to worry about newer compilers not including <iostream.h>. Also, it is perhaps good to keep in mind that for the most part, software is updated for a purpose
    Turn no more aside and brood
    Upon love's bitter mysteries
    For Fergus rules the brazen cars...

  10. #10
    Sir Mister Insane Sako Klinerr1's Avatar
    Join Date
    May 2002
    Posts
    608
    i changed my avatar, i mgiht change it again so its color is closer he to boards colors
    Email: [email protected] || AIM: MisterSako || MSN: [email protected]

    -the shroom has spoken

  11. #11
    Registered User GrNxxDaY's Avatar
    Join Date
    Jul 2002
    Posts
    140
    MEEE i want avatar
    AOL: GrNxxDaY
    IDE: Dev-C++ Beta 5 (v4.9.4.1)
    Project: Eye of Sahjz (text-RPG)
    If you think I may need help, please IM me.

  12. #12
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    I've got a nice avatar
    what does signature stand for?

  13. #13
    Registered User GrNxxDaY's Avatar
    Join Date
    Jul 2002
    Posts
    140
    Me too! look mine says N00B
    AOL: GrNxxDaY
    IDE: Dev-C++ Beta 5 (v4.9.4.1)
    Project: Eye of Sahjz (text-RPG)
    If you think I may need help, please IM me.

  14. #14
    Seeking motivation... endo's Avatar
    Join Date
    May 2002
    Posts
    537
    Ruski's is the coolest avatar I've ever seen, I'd like one similar but can't be bothered to search for one.

    If std::cout is good practice what about putting using statements at the top instead?

    using std::cout;
    usin std::endl;
    etc, etc
    Couldn't think of anything interesting, cool or funny - sorry.

  15. #15
    Registered User
    Join Date
    Jun 2002
    Posts
    267
    They're fine... what I'm getting at is that it's not good to just slap "using ....." at the top of code because you've been told to, you need to know that it's a shortcut from having to write out the scope of something over and over; that's all I'm saying

    and about the <iostream.h> thing, I wasn't serious about actually using that, I was saying that if you wanted to avoid having to specify the std scope for iostream, that you could use that... but, don't do it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why std:: and not using namespace std?
    By swappo in forum C++ Programming
    Replies: 4
    Last Post: 07-03-2009, 03:10 PM
  2. std:: or namespace std
    By C-+ in forum C++ Programming
    Replies: 16
    Last Post: 12-04-2007, 12:30 PM
  3. Builder 5 v's bcc32.exe
    By sononix in forum C++ Programming
    Replies: 3
    Last Post: 08-17-2004, 10:17 AM
  4. need ; before using namespace std
    By wwfarch in forum C++ Programming
    Replies: 7
    Last Post: 05-11-2004, 10:42 PM
  5. Site tutorials
    By Aalmaron in forum C++ Programming
    Replies: 20
    Last Post: 01-06-2004, 02:38 PM