Annoying compilers

This is a discussion on Annoying compilers within the A Brief History of Cprogramming.com forums, part of the Community Boards category; This is just a rant (and the code is not the real code). Recently I ran into a runtime problem ...

  1. #1
    The larch
    Join Date
    May 2006
    Posts
    3,573

    Annoying compilers

    This is just a rant (and the code is not the real code).

    Recently I ran into a runtime problem because of the following scenario (resulted from a typo).

    Code:
    class A
    {
        int x;
    public:
        A(): x(x)
        {
        }
    };
    
    int main()
    {}
    Why o why can't MingW not Visual Express 2005 even warn that a member is being initialized with itself (or do I miss some compiler flags, or are there any cases where this obviously isn't an error)!?

    Another recent annoyance is with Visual Express 2005. I couldn't figure the compiler error out until I compiled the same file with MingW, because the error message is so misleading that I was looking intently at the wrong place (and all the files included from this header to see if there's a stupid error like a missing ; or a mistyped inclusion guard etc):
    Code:
    class A
    {
        int n;
    public:
        A(float, n m) {n = m; }
    };
    
    int main()
    {}
    MSVC error diagnostics:
    main.cpp(5) : error C2062: type 'float' unexpected
    WTF! How is float (in my case another type - so I suspected circular dependencies) unexpected?

    whereas MingW says
    main.cpp:5: error: `n' is not a type
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  2. #2
    Registered User
    Join Date
    Aug 2008
    Posts
    188
    messing up syntax with templates is much more annoying. WADAYAMEAN I HAVE 5924 errors!?!?

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    188
    interesting, with VS2005 pro i get this for your 2nd annoyance:
    Code:
    Error	1	error C2061: syntax error : identifier 'n'

  4. #4
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    > or are there any cases where this obviously isn't an error
    Function pointer for a recursive algorithm or something?

  5. #5
    Registered User
    Join Date
    Jun 2008
    Posts
    266
    VC++ is a walk in the park compared to the errors Dev-C++ gives you.

  6. #6
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    > Dev-C++ gives you.
    That is MinGW

  7. #7
    Registered User
    Join Date
    Jun 2008
    Posts
    266
    Quote Originally Posted by zacs7 View Post
    > Dev-C++ gives you.
    That is MinGW
    I knew that. I was just testing you.

  8. #8
    The larch
    Join Date
    May 2006
    Posts
    3,573
    What do you think about VC++'s warnings level 4? It spits a ton of warnings on you for any piece of code, so does it have any practical use?
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  9. #9
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,409
    Quote Originally Posted by anon
    What do you think about VC++'s warnings level 4? It spits a ton of warnings on you for any piece of code, so does it have any practical use?
    Once you disable the "secure" warnings, the rest should actually be useful, though often benign as in they just require a legitimate type cast to silence.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  10. #10
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    I think that VC++'s error recovery is a disaster. No matter what you do wrong, you always get two or three inane follow-up errors that make it completely impossible to fix more than one error per compilation.
    Its saving grace is that it compiles fast.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  11. #11
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    MSVS does have awful error recovery and since I'm using 2003 at work it also crashes or just exits a lot. It does not seem to do well with multi-threaded apps and often one bad thread will keep the GUI busy to the point you have to end task on it. 2003's function browser is also near non-existent b/c half the time you can click on the function and nothing happens. Then the focus get's stuck in the function drop down and you have to press the middle mouse button just to get focus back to the code window. 2003 also has a big error where it throws up some weird window that stretches to my second monitor and yet you cannot click on it or remove it.
    2003 also gets confused if you are in a remote debugging session and the client system goes down for some reason. 2003 will basically say the program is still runing even though your second system is rebooting. It won't let you stop debugging or anything and will force you to end task on dev.exe. 2003 frequently exits the IDE but does not shut down the process. So the next time you fire up 2003 you will get an NCB error since the other existing dev.exe still has it locked. This forces you to shut down your second 2003 instance, end task on the first, and then restart 2003.

    That said 2005 is far better than 2003. I have not experienced any major issues with 2005 save for the very annoying side-by-side linker error which is hard to fix and diagnose. I only have 2005 standard so I don't know much about how professional acts. The so-called deprecated CRT is extremely annoying in 2005 but luckily can be turned off by defining_CRT_SECURE_NO_DEPRECATE in the preprocessor. I know why Microsoft 'deprecated' it but they created a bigger mess when they renamed every CRT function with a trailing _s or _n. Now the MS version of the CRT is confusing at best. 2005's Intellisense and function browsing is far superior to 2003's. Also 2005 has much more flexibility when it comes to separating errors and warnings than 2003 does. The one think I completely dislike about 2005 is that it only searches the current open document for key user defined comments like HACK, FIX LATER, etc. 2003 used to search the entire program which made it very nice when you wanted to go in and finally properly fix the 'HACK' sections of code. 2005 has made this feature unusable.

    But overall I think MSVS is a very good compiler and it compiles very fast which is a definite plus. Neither 2003 or 2005 seem to use more than one thread when compiling which brings my quad-core processor at work to it's knees and maxes out 1 core all the time. Not sure why they could not fire off multiple threads for the actual compile process. Perhaps synchronization would have been too difficult. Again I do not know for sure how many threads are being used but it appears from the task manager that only 1 is used. If more were used I would expect to see some activity out of the other cores and yet they are usually flatlined or very close to it during compile.

    I've also noticed on all MSVS versions that bringing up help internally is three times as slow as bringing it up externally. Not sure why this is. This seems to be even worse in 2005. I normally bring up my DirectX help and MSDN outside of the IDE b/c inside causes tons of problems. I do love the search ability in MSVS and it is extremely fast. Go to function declaration and function definition seem to be nearly broken in 2003. Half the time it cannot figure out the difference between declaration and definition. I wish there was a find option in the context menu b/c it's much easier than pressing CTRL SHIFT F. Same holds true for search and replace.

    Warning level 4 is what I always use for compiles but it is almost useless if you are using the STL in MSVS. xtree.h throws up about 50 warnings from inside the STL which is just ridiculous. Does not make me feel very good when my STL is puking tons of warnings.
    Last edited by VirtualAce; 11-27-2008 at 12:01 PM.

  12. #12
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Not sure why they could not fire off multiple threads for the actual compile process. Perhaps synchronization would have been too difficult.
    I don't believe it. Launching multiple compilers in parallel must be among the simplest and most efficient ways of using multiple hardware threads.
    But I don't have any idea why they don't do parallel builds either.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  13. #13
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,424
    Quote Originally Posted by Bubba View Post
    MSVS does have awful error recovery and since I'm using 2003 at work it also crashes or just exits a lot. It does not seem to do well with multi-threaded apps and often one bad thread will keep the GUI busy to the point you have to end task on it. 2003's function browser is also near non-existent b/c half the time you can click on the function and nothing happens. Then the focus get's stuck in the function drop down and you have to press the middle mouse button just to get focus back to the code window. 2003 also has a big error where it throws up some weird window that stretches to my second monitor and yet you cannot click on it or remove it.
    2003 also gets confused if you are in a remote debugging session and the client system goes down for some reason. 2003 will basically say the program is still runing even though your second system is rebooting. It won't let you stop debugging or anything and will force you to end task on dev.exe. 2003 frequently exits the IDE but does not shut down the process. So the next time you fire up 2003 you will get an NCB error since the other existing dev.exe still has it locked. This forces you to shut down your second 2003 instance, end task on the first, and then restart 2003.
    Well, wow. All I can say is that Microsoft do make buggy software.
    Thankfully, I don't have 2003 anymore.

    The so-called deprecated CRT is extremely annoying in 2005 but luckily can be turned off by defining_CRT_SECURE_NO_DEPRECATE in the preprocessor.
    I find it annoying that no-one uses the safer versions and sticks to old, messy crap versions.

    I know why Microsoft 'deprecated' it but they created a bigger mess when they renamed every CRT function with a trailing _s or _n. Now the MS version of the CRT is confusing at best.
    So what should they have done? Replaced the old functions with their newer, safer ones? Now that would break a lot of code...

    But overall I think MSVS is a very good compiler and it compiles very fast which is a definite plus. Neither 2003 or 2005 seem to use more than one thread when compiling which brings my quad-core processor at work to it's knees and maxes out 1 core all the time. Not sure why they could not fire off multiple threads for the actual compile process. Perhaps synchronization would have been too difficult. Again I do not know for sure how many threads are being used but it appears from the task manager that only 1 is used. If more were used I would expect to see some activity out of the other cores and yet they are usually flatlined or very close to it during compile.
    Now that is very odd, because I know that with 2005, at the very earliest, the IDE does indeed utilize multiple cores.
    It always spawns two threads when compiling for me, maximizing my dual core. It actually compiles multiple sources files in parallel.

    Warning level 4 is what I always use for compiles but it is almost useless if you are using the STL in MSVS. xtree.h throws up about 50 warnings from inside the STL which is just ridiculous. Does not make me feel very good when my STL is puking tons of warnings.
    Warnings level 4 is something I cannot live without. It provides huge amounts of valuable warnings.
    Unused variables, potentially unused variables, non-standard extensions, conversion warnings, among what I can remember.
    Not sure why a header would spit out a lot of warnings, though. Never did for me, but then again, I never included xtree.h.

    Quote Originally Posted by CornedBee View Post
    I don't believe it. Launching multiple compilers in parallel must be among the simplest and most efficient ways of using multiple hardware threads.
    But I don't have any idea why they don't do parallel builds either.
    But it does...
    At least it does for me.
    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.

  14. #14
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Elysia View Post
    I find it annoying that no-one uses the safer versions and sticks to old, messy crap versions.


    So what should they have done? Replaced the old functions with their newer, safer ones? Now that would break a lot of code...
    No, they should have found a way to get consensus of how to get the standard library safe from all compiler/OS vendors - yes, that would take a lot longer. But if you want to write code that is portable, you will either have to write your own safe functions (assuming there is no safe standard function to use), as it stands.

    I also find some of the MS versions of "safe" functions annoyingly strange (as in, they pass the arguments in a funny order in some cases - can't think of a particular case right now - just remember seeing something and thinking: "What the h*** where they thinking?").

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  15. #15
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,424
    Quote Originally Posted by matsp View Post
    No, they should have found a way to get consensus of how to get the standard library safe from all compiler/OS vendors - yes, that would take a lot longer. But if you want to write code that is portable, you will either have to write your own safe functions (assuming there is no safe standard function to use), as it stands.
    I am with Microsoft on this boat, however.
    This did it quickly - added what the industry needed.
    Now, they can try to continue persuading the ones in charge of the standard later in hopes of getting something standard, but at the time, they certainly did the correct thing, if you ask me. The shortcoming is of the standard.

    I also find some of the MS versions of "safe" functions annoyingly strange (as in, they pass the arguments in a funny order in some cases - can't think of a particular case right now - just remember seeing something and thinking: "What the h*** where they thinking?").
    I don't really share that sentiment, but then again, when I first passed as a VB dev to a C++ dev, I thought why the heck did they put the destination argument first? Because in VB, the source argument was always first.
    It's all a matter of taste. But I got used to it. Dst first, src later.
    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.

Page 1 of 3 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ Builder Comparison
    By ryanlcs in forum Tech Board
    Replies: 14
    Last Post: 08-20-2006, 09:56 AM
  2. Is It Possible To Install Multiple Compilers?
    By mishna_toreh in forum C Programming
    Replies: 3
    Last Post: 05-13-2005, 07:32 AM
  3. Compilers for Windows
    By LegendsEnd in forum Windows Programming
    Replies: 2
    Last Post: 03-26-2004, 07:03 AM
  4. small compilers?
    By Korn1699 in forum C++ Programming
    Replies: 2
    Last Post: 06-22-2003, 05:58 PM
  5. Compilers, Compilers, Compilers
    By Stan100 in forum C++ Programming
    Replies: 11
    Last Post: 11-08-2002, 03:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21