Like Tree20Likes

Frustration in learning C++

This is a discussion on Frustration in learning C++ within the General Discussions forums, part of the Community Boards category; The programmers who only use one compiler, learn to rely on obscure features of that compiler or its library, and ...

  1. #31
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,214
    The programmers who only use one compiler, learn to rely on obscure features of that compiler or its library, and then insist there is nothing wrong with their code when another compiler rejects the code.
    ++And it is an infection that just spreads and spreads!

    Soma

  2. #32
    Epy
    Epy is offline
    Fortran lover Epy's Avatar
    Join Date
    Sep 2009
    Location
    California, USA
    Posts
    955
    Quote Originally Posted by grumpy View Post
    Those who slavishly insist on premature optimisation. Those who delight in squeezing 25 critical side effects into a single unreadable statement. Those who insist on using a bitwise operation to divide by 2, and those who insist on multiplying by 2 in order to shift bits.
    I used to be like that...there are a lot of older articles on optimization in C that will swear by doing these sorts of things. However, one eventually learns that modern compilers are made to take the simpler statements and perform these optimizations automatically. Modern optimizing compilers want you to simply tell them what you want the program to do in the simplest terms, and hopefully will produce the most optimized product available while preserving a readable code.

  3. #33
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,657
    That's a fair point but I think grumpy's is more to the effect it has when you're really doing one thing (bit fiddling) and deliberately trying to be cute (using arithmetic).

    There is a certain productivity to being able to do a lot with a line, but that's easier in higher level languages.

    Both of these things kind of make you wonder what people really care about.
    Epy likes this.

  4. #34
    Epy
    Epy is offline
    Fortran lover Epy's Avatar
    Join Date
    Sep 2009
    Location
    California, USA
    Posts
    955
    Being in the programming "business", so often one programmer will quickly throw some code together, completely undocumented and cryptic in nature. Then they leave the company, leaving the next person completely lost. People ought to care about readability first and foremost, and if you have to do something cryptic, comment the hell out of that line so that an idiot can understand it. Code can almost be described as beautiful when you program in this way, and it makes it's courteous to the next man.

  5. #35
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    comment the hell out of that line so that an idiot can understand it
    Comments are great so long as they are correct. Often times code sections get updated and yet the comments do not which is essentially the same as having no comments. Heavily commented code usually results in large incorrect sections of comments b/c most programmers fail to update the comments. As well various integrations and merges can cause the comments to be out of place. I have seen comment sections that began 1 line out of place and about a year later the section was almost 50 lines out of place.

    Most of the time when I am learning a new code line I rarely, if ever, rely on the comments. I may refer to them when I just cannot figure the code out but more often than not I will ask someone or find someone to ask that has worked on the code. That sure beats sitting there spinning my wheels all day long.

    And remember no matter how much you idiot proof your code there is always a bigger idiot out there. Readability is key but going overboard actually hurts readability. I believe it is a balancing act that you learn through experience.
    MK27 likes this.

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

Similar Threads

  1. Frustration with tutorial.
    By A34Chris in forum C Programming
    Replies: 19
    Last Post: 03-18-2008, 03:08 AM
  2. Frustration
    By curlious in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 09-29-2003, 02:22 PM
  3. Frustration ...
    By goran in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 08-06-2003, 11:21 PM
  4. DLL frustration
    By robid1 in forum C Programming
    Replies: 4
    Last Post: 06-22-2003, 03:37 AM
  5. Frustration
    By kas2002 in forum C++ Programming
    Replies: 4
    Last Post: 05-29-2002, 05:00 PM

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