Thread: Can we have vector of vector?

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Remarkably, the MinGW port of g++ 3.4.5 compiles your example without errors even with -Wall. The Comeau online compiler finds it okay too.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #17
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Elysia View Post
    Indeed. They are included automatically. I find it convenient, though, not annoying.
    I don't see what's so wrong with it?
    If all you do is program on Windows then there's no problem, but if you're writing for Windows & UNIX, you could have code that compiles on Windows and doesn't on UNIX.

    It doesn't really take that long to fix, but it still annoys me.

  3. #18
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Then stuff all common includes in one header and include it in your projects. Problem fixed.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #19
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by laserlight View Post
    Remarkably, the MinGW port of g++ 3.4.5 compiles your example without errors even with -Wall. The Comeau online compiler finds it okay too.
    Actually, I only tried this particular example on VC++, but I remember seeing a problem like this where I was missing some C headers... Whether I saw it on Linux, Solaris or both, I don't remember.

  5. #20
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Actually, I only tried this particular example on VC++, but I remember seeing a problem like this where I was missing some C headers...
    Well, it goes to show that the problem is not MS specific.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #21
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by laserlight View Post
    Well, it goes to show that the problem is not MS specific.
    OK, I surrender.
    There's lots of other things to complain about, so I'll let MS win (this time).

  7. #22
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Elysia View Post
    I don't really understand why the standard specifies you must use > > either, since it's rather absurd. It doesn't really matter if it can be mistaken for the operator or not, since it's the compiler vendor's work to make sure it works.
    Allowing '>>' in template declarations seems like a simple enough requirement, but the amount of work required in the compiler's parser would be ridiculous in comparison to the benefit of allowing it, which is practically zero.

    And the idea of a standards body is to formalize and enhance existing practice, not to subject implementers to onerous, pointless requirements. It's not, "We create the standard and now you have to do it this way," it's practically the exact opposite.

  8. #23
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Of course, now that compiler vendors have had time to make the necessary changes to handle >>, they will be changing the next standard to allow it.

    In this case, not allowing >> is odd and forcing compiler vendors to support it makes sense once they have enough time to do so.

  9. #24
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    MSVS 6, 2003, and 2005 all have had this 'auto-include' of headers for quite some time. The problem comes when it demands you must include some headers but yet does not enforce you including others that the code clearly needs. It has something to do with your project options and which 'common' libraries/headers, if any, you wish to use. By default MSVS knows where the standard libraries are as well as the headers. Once you install Platform SDK and integrate it into VS it usually also knows where to find the Platform SDK files. There are times when you can get away with not including Platform SDK headers and it will still compile.

    However what is very odd in VS is Intellisense. Often it shows functions, variables, etc, that look to be accessible and yet often when you compile it complains of unresolved externals or undefined symbols. Intellisense often does not match exactly what is 'visible' at the current location in your code. Often times it shows functions and methods that are clearly not accessible yet it appears they are. This is extremely annoying. Other times Intellisense just completely fails to show anything, does not update correctly when you alter headers, or gets corrupted.

  10. #25
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Bubba View Post
    However what is very odd in VS is Intellisense. Often it shows functions, variables, etc, that look to be accessible and yet often when you compile it complains of unresolved externals or undefined symbols. Intellisense often does not match exactly what is 'visible' at the current location in your code. Often times it shows functions and methods that are clearly not accessible yet it appears they are. This is extremely annoying.
    That behavior was changed in MSVC8 (aka 2005). It actually needs the proper headers to be able to see the functions.

    Other times Intellisense just completely fails to show anything, does not update correctly when you alter headers, or gets corrupted.
    Yes, IntelliSense support is quite old by now, though I've heard they'll be updating it for the next version. Thank the gods for that; it's quite a mess right now.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can some one please tell me the cause of the error ?
    By broli86 in forum C Programming
    Replies: 8
    Last Post: 06-26-2008, 08:36 PM
  2. syntax help?
    By scoobygoo in forum C++ Programming
    Replies: 1
    Last Post: 08-07-2007, 10:38 AM
  3. Vector class
    By Desolation in forum C++ Programming
    Replies: 2
    Last Post: 05-12-2007, 05:44 PM
  4. Need some help/advise for Public/Private classes
    By nirali35 in forum C++ Programming
    Replies: 8
    Last Post: 09-23-2006, 12:34 PM
  5. Certain functions
    By Lurker in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2003, 01:26 AM