Thread: Benifits of differnt file locations

  1. #1
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215

    Benifits of differnt file locations

    Hi

    just a quick question wondering what are the benifits of putting cpp files in different locations

    the only one i can think of is that it makes it easier to manage

    also that you can have a group of programmers working together and then just link it all at the end

    if there are others please can you help?

    Thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    That's pretty much it.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by peckitt99 View Post
    the only one i can think of is that it makes it easier to manage

    also that you can have a group of programmers working together and then just link it all at the end
    It also helps you to group related functionality into one place. Your code should be designed as modules, and it should therefore be organized on disk as modules.

    Also, who the heck wants to work on a 1.6 million line source file? Programs can be VERY large.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    The most obvious reason to put various source files in different locations is that they are separate parts of a larger whole, e.g. some files produce one executable file, another set of files produce another executable. Some files may be shared, in which case they need to go into a separate location (don't HAVE to, but it makes life easier that way).

    There's really no other reason to have files in separate locations - the compiler certainly doesn't mind if you use 6 files out of a directory of 10000, or if you have 6000 directories containing a file each, to produce your executable. So from that perspective, how your files are stored makes no difference at all.

    Several people can work on files in the same location - as long as you have a system of "locking" files so that only one person can update a particular file - or, better yet, let each person have their own local copy and use a source/version control software to track and merge the result of the changes.

    --
    Mats

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  2. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  3. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM
  4. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  5. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 10:57 AM