Things you hate in C/C++

This is a discussion on Things you hate in C/C++ within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Borland-specific: That you have to press CTRL-K-S (instead of CTRL-S) to save......

  1. #16
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    reply

    Borland-specific:

    That you have to press CTRL-K-S (instead of CTRL-S) to save...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  2. #17
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    Seriously, one thing I really hate is how, half the time, reading every error is worthless - fixing the first one "fixes" the others, that weren't really problems to begin with.

    Example:

    Error something (I'm not feeling creative on a Monday morning)
    Error: missing ';' on line "printf("Hello");

  3. #18
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    This is more compiler specific than language specific, but I'd like more strict syntactic and semantic error checking as well as more informative errors and warnings.

    Other language specific dreams:
    1. Removing the break from switch statements. Good designs fall through only about 3% of the time anyway so why make us code more to get around a feature that is so rarely used. Some compilers and especially lint issue a warning if you don't comment that you've fallen through...something is wrong with that.

    Also, what if you break from a loop inside a switch case? Well, you break from the case as well. That's most annoying.

    2. Several of the keywords should be renamed to something more informative, such as const being read_only.

    3. Change precedence rules so that they are more logical and intuitive. It's hard for new programmers to get used to them and they tend to forget parens when they need them.

    -Prelude
    My best code is written with the delete key.

  4. #19
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    > int main (void) should be compulsary, compilers should throw an error if they encounter void main () or any other alias of it

    Partially, yes... it should throw an error if main's declared anything other that int, but it shouldn't force you to declare it as int main(void), in case cmd line arguments are being passed.

    > compilers should throw a warning if it encounters a system call

    (Pipe Dream) Maybe they could go as far as suggesting better solutions for basic things, like in a PAUSE or cls call...

  5. #20
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    What I hate most is that things that are bool by nature can be syntactically satisfied with any number or pointer.

    Example: if

    if( i ) DoIt();

    WTF ?

    if should take a boolean value and ONLY a boolean value. I hate those C compliant stuff that leaves me with code that is hard to understand and even harder to grasp by people not coming from a pure C background. There is no reason a NULL pointer should represent the same as FALSE or false or any other BOOL/bool value.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  6. #21
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    >>I finished qBASIC programming before this and it was sooooo >>simple to do simple graphics).

    he he, thats because QBasic isnt a real language!
    would you like keywords in caps too ?
    Monday - what a way to spend a seventh of your life

  7. #22
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    Not sure if I understand you well enough, nvoigt. But I do "if( i ) DoIt();" a lot. Maybe I'm just too lazy to type "== 1" or "== TRUE", but most likely I just like it better. You know how everyone adopts a style...

  8. #23
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    [quote]Also, what if you break from a loop inside a switch case? Well, you break from the case as well. That's most annoying.[quote]Could you clarify this?
    Callou collei we'll code the way
    Of prime numbers and pings!

  9. #24
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >Could you clarify this?
    Sorry, I meant to write test instead of loop. I'm not sure if a loop would do the same thing but what I meant was this:
    Code:
    switch( SOMETHING ) {
        case ONE:
            foo();
            break;
        case TWO:
            if( x == STUFF ) {
                bar();
                if( y == OTHER_STUFF )
                    break;
                baz();
            } /* Meant to break to here */
            init_something_important();
            break;
        default:
            error_message();
    } /* Doh! Actually broke to here */
    
    use_something_important(); 
    /* Something important was uninitialized, nasty bug... */
    -Prelude
    My best code is written with the delete key.

  10. #25
    edwardtisdale
    Guest
    link errors out of nowhere

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Suggestions for things to study
    By Mastadex in forum Windows Programming
    Replies: 5
    Last Post: 08-18-2008, 09:23 AM
  2. 2 things at once?
    By bradszy in forum C++ Programming
    Replies: 7
    Last Post: 02-20-2008, 12:19 PM
  3. Pet Peeves
    By Srg Pepper in forum A Brief History of Cprogramming.com
    Replies: 29
    Last Post: 10-03-2002, 11:34 AM
  4. Help with these three things...
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 08-26-2001, 07:05 AM

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