Thread: 20 Tips to Improve Your Code

  1. #1
    Registered User Aran's Avatar
    Join Date
    Aug 2001
    Posts
    1,301

    20 Tips to Improve Your Code

    i found a rather interesting site last night that gives 20 tips to improve your C++ coding.

    I'd like to know the opinions of the experienced people here on these tidbits of info before i post mine, because i'm sure most of the hackers (NOT crackers) here have been doing this stuff for far longer and understand it far better than i.

    well, here's the site (and an interesting read it is):
    http://www.devx.com/cplus/free/artic...s/toptips2.asp

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    that's a pretty good list. These are good guidelines that are hard to keep in mind sometimes.

    but.....

    hackers don't code C++. Programmer/Developers do. if you want hackers, you should try the C board
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Registered User Aran's Avatar
    Join Date
    Aug 2001
    Posts
    1,301
    grr.. a hacker is an outstanding coder who knows alot about computers and how they work.

    A cracker is someone who attacks/breaks into other people's/company's security.

    all programmers should know the difference.

    read this if you don't believe me:
    http://www.tuxedo.org/~esr/faqs/hacker-howto.html
    Last edited by Aran; 08-15-2002 at 09:36 PM.

  4. #4
    Registered User
    Join Date
    Aug 2002
    Posts
    16
    hacker = good coder

    True.

    cracker = small crispy biscuit

    Also true.

    There are many different ways to define many different words, and for most of the world, hacker = cracker.

    --Chorus

  5. #5
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    I have always defined a "hack" as something that is stuck into code as a band-aid. Not a correct fix or proper form. A hacker as I have always seen it is a sloppy coder or someone who doesn't think about proper design and the result is something that can only be maintained by a hacker.

    Maybe its not the correct definition but it's the one I've used. And I wasn't saying that they had anything to do with cracking either.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  6. #6
    Banal internet user
    Join Date
    Aug 2002
    Posts
    1,380
    anyone here ever crack a CD check/key?

  7. #7
    Unregistered
    Guest
    first: im not really Exped: enough to be considered a real Hacker i have no delusions of grandure.

    second: until salems final word all that i say is not necessarily right.

    Tip 1: Is not always applicabe since now most compilers just use something like this.

    // iostream.h
    Code:
    #ifndef _IOSTREAM_H
    #define _IOSTREAM_H
    
    #include <iostream>
    #include <ostream.h>
    #include <istream.h>
    #include <streambuf.h>
    #include <ios.h>
    
    //ect...
    	using std::cin;
    	using std::cout;
    	using std::cerr;
    	using std::clog;
    //ect...
    then again... some don't

    Tip 2:

    as for "tip 2", if you declared f() without the constant identitifier, you should not compile without some finegaling anyway, since you cannot have a reference to a true Rvalue.

    Tip 3: ok, you really shouldn't use comma's anyway since the intention is not always clear and they make code harder to read.

    Tip 7: as far as specifically avoiding the dynamic memory, i say don't, but the rest is fairly sound. STL containers are quite nice.

    Tip 15: on most compiler you cannot compile a template unless its definded in the header file its declared in anyway.

    Tip 19: proper coding habits prevent this. and vector may add substantial overhead.

  8. #8
    Registered User
    Join Date
    Apr 2002
    Posts
    362
    Kudos to both the article's author, Danny Kalev, and you for sharing the site with us.

    Having spent a fair amount of time poring over the STL, I found the information insightful and the article well-written.

    Now, about that 'Big Oh' thing...

    Thanks.

    (I'm looking forward to yours, though...)

    -Skipper
    "When the only tool you own is a hammer, every problem begins to resemble a nail." Abraham Maslow

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can someone double check and maybe improve my code
    By tommy69 in forum C Programming
    Replies: 23
    Last Post: 04-21-2004, 02:04 PM
  2. Problem : Threads WILL NOT DIE!!
    By hanhao in forum C++ Programming
    Replies: 2
    Last Post: 04-16-2004, 01:37 PM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  4. My Allegro Program will not run...
    By Vicious in forum Game Programming
    Replies: 17
    Last Post: 06-14-2002, 12:49 AM
  5. Replies: 4
    Last Post: 01-16-2002, 12:04 AM