Thread: compiling main first...

  1. #1
    False Return hubris's Avatar
    Join Date
    Apr 2009
    Posts
    33

    compiling main first...

    I tend to compile my main first before I've ever even defined any functions so I've always got a page to return to if I get lost. Anyone else do that? Or do some start laying out function definitions and variables first, and filling up main later?

  2. #2
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    I use main to coordinate my functions so there is really no point for me to compile it by itself
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  3. #3
    False Return hubris's Avatar
    Join Date
    Apr 2009
    Posts
    33
    Hmmm. I guess it also depends on the project. If my program has some initial cin/cout conversation I do main. If it's just to process a file or calculate complex math without any cin I start with functions and build main later.

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    C++ is just silly.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #5
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    C++ is just silly.
    I fail to see what, if any, value that adds to this thread.


    Main is usually the shortest function and is usually not altered in the code I work in so compiling it first really gains nothing. One practice I have gotten into is if I'm making a lot of changes in certain files in the solution I do tend to attempt to get them compiling by themselves first before attempting to rebuild the entire solution. I find it makes the errors a bit more manageable. Again I'm using MSVS 2003 which does not separate out the errors and warnings. 2005 and 2008 do separate them which makes the entire process a bit easier.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 10-15-2008, 03:38 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Return Statement
    By Daveo in forum C Programming
    Replies: 21
    Last Post: 11-09-2004, 05:14 AM
  4. void main
    By Shadow in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 05-29-2002, 07:08 PM
  5. void or int for main?:)
    By bigtamscot in forum C Programming
    Replies: 13
    Last Post: 09-27-2001, 03:11 AM