Thread: source style recommendations: in search of...

  1. #1
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001

    source style recommendations: in search of...

    i just checked, and i have [for my file4 project] 49 source code files over 98.9 K [784 K on disk]... [makes a nice 7 by 7 tiled window alignment...btw]... a lot of these are just skeleton-files holding includes of class defns and function defns... how can i reduce the number of source code files without losing the expandibility i gain with the skeletal structure? when coding classes, do you put all of it in one large file? i find that being able to scroll with the bar over all sections of your source code comfortably is of paramount importance... and that having to search for a function name seems like you've got bloated source syndrome... any advice is helpful... thanks...
    hasafraggin shizigishin oppashigger...

  2. #2
    Well, if you're working on any real-sized project, you're just gonna have lots of files. However, usually, you'll be working with only a handful of them at a time because that's where your attention is focused. I mean, for example, once your disk I/O routines are done, you almost never have to open that file again.

    Also, If you have any kind of decent compiler, you should have a popup menu at the top you can click and it lists the functions in the file your in. Otherwise, you should _know_ what files your functions are in.

    Perhaps this will help--

    I tend to break project files this way--

    consts.h - holds all constants
    typedefs.h - holds all special typedefs/defines/enums
    chrono.h - project history documention (not included in project)
    main.c/h - main() and event type stuff
    menu.c/h - menu bar management
    filei/ - generic file i/o routines
    core.c/h - whatever project is really about
    and so on

    I break files up by functionality. Now that you don't have segment limitations you can put as many functions/procs in a sourcefile as you like.


  3. #3
    Registered User alex's Avatar
    Join Date
    Sep 2001
    Just some ideas:

    If you can distinguish quite different tasks in your project, you could make subdirectories for each task (i.e. the interface code for a window or dialog box, the code for a computation thread, input/output functions for each filetype...). Usually you're focussing on one such a task at a time, so it won't make you switch directories a lot.
    Some people like to put all .h-files and resource file in separate directories.
    Most people programming C++ like to put only one class in each .C-file, and then call the .C-file identical to the class in the file. In plain C you can "emulate" C++ by "intelligent" use of static variables and functions.

    Anyway: whatever you choose to do, it's never right in the eyes of other programmers .


  4. #4
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    well, actually i do have them sorted per directory... but well, i guess it's just that in the workspaces in JFE they don't have the complete path name and i can't reorganize the directory structure in it's mini-explorer type thing... it is cool though since it has listings of functions under each file! so that's a plus. i emailed jens about it, and he responded once, but then with this new question i haven't had a responce... so, thanks, and does anyone use JFE perhaps who could help? thanks...
    hasafraggin shizigishin oppashigger...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  2. Search Engine - Binary Search Tree
    By Gecko2099 in forum C Programming
    Replies: 9
    Last Post: 04-17-2005, 02:56 PM
  3. Firefox and Google Search
    By DeepFyre in forum Tech Board
    Replies: 0
    Last Post: 01-16-2005, 10:28 AM
  4. Simple search program
    By colinuk in forum C Programming
    Replies: 6
    Last Post: 12-18-2004, 01:58 AM
  5. Source code style
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 06-26-2002, 02:22 AM