Thread: C++ Programming Tips

  1. #16
    Registered User caroundw5h's Avatar
    Join Date
    Oct 2003
    Posts
    751
    Do you experienced programmers tend to have a common syntax or logic errors? Like
    Code:
    if (size = 3)    instead of     if (size == 3)
    Stuff like that?
    I think everyone falls into that trap now and then when their brain is farting like coding late at night a simple trick to avoid this problem is this
    Code:
    size = 3 /* size gets 3 */
    size == 3 /*size equals three or size is three */
    I came across this a while ago and it seems to help me out.


    I don't see debugging in there. Is that under testing?
    That would be assumed under testing. Yes. perhaps I should have added.
    1.plan
    2.code
    3.test
    4.pull hair!! beat head against wall repeatedly
    4.repeat steps 2 - 4 ad nauseam.
    Last edited by caroundw5h; 09-14-2004 at 11:22 AM.
    Warning: Opinions subject to change without notice

    The C Library Reference Guide
    Understand the fundamentals
    Then have some more fun

  2. #17
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Do you guys write like pseudocode or do UML designs
    I use whatever design medium the project requires. For personal projects I'm not nearly as organized.

    >Do you experienced programmers tend to have a common syntax or logic errors?
    I have a nasty tendency to forget to dereference a pointer at the worst possible place. For example:
    Code:
    struct node *insert_node_r ( struct node *tree, int data, int *deeper )
    {
      ...
      if ( deeper ) {
        /* Rebalance */
      ...
    }
    deeper is never a null pointer, so the tree is always rebalanced even when it isn't needed (or wanted). I wrestled with this particular bug for too long this morning.

    >Is there much time spent debugging?
    It really depends on the programmer.
    My best code is written with the delete key.

  3. #18
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    >>I have a nasty tendency to forget to dereference a pointer at the worst possible place.
    At least you won't run into type punning problems

    >>It really depends on the programmer.
    And to a certain extent, I believe, the budget
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  4. #19
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    And ask a many questions as you need on this board. The people are really helpful and will not quit helping you until you get it. (You will most likely quit before them, if it takes weeks).

  5. #20
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    my own personal method for debugging, which you may want to try ,is to not ever make mistakes.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  6. #21
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Quote Originally Posted by The Brain
    my own personal method for debugging, which you may want to try ,is to not ever make mistakes.


    I really never debugged anything until I started making an emulator. Then you really learn how a debugger works, and in some cases make your own little GUI debugger for your program.
    What is C++?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Programming Tips
    By webmaster in forum General Discussions
    Replies: 27
    Last Post: 10-29-2018, 12:49 PM
  2. Ballon Tips in C++ (Borland C++ Builder 6)
    By dfghjk in forum C++ Programming
    Replies: 4
    Last Post: 05-11-2008, 08:00 PM
  3. Tips on becoming a competent programmer
    By trickae2 in forum C Programming
    Replies: 16
    Last Post: 08-28-2006, 07:33 PM
  4. any useful tips to increase speed when parsing files
    By Shadow12345 in forum C++ Programming
    Replies: 2
    Last Post: 01-18-2003, 05:52 PM
  5. Tips
    By laughman in forum C++ Programming
    Replies: 5
    Last Post: 10-01-2002, 11:48 AM