Thread: more multiple file problems

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    8

    more multiple file problems

    I swear I've tried everything at this point, but no matter what I do, the only way to avoid errors is to throw everything into one file, which ends up a tangled nightmare of code.

    There's 3 distinct sets of functions: entry point & proc loop, rendering functions, and the main (editable) functions. The main functions and the entry point use the rendering functions constantly. All three sets of functions need to use the same set of global variables and constants.

    Is there any way I can possibly accomplish this in an organized fashion without having to pass everything?

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    It's probably better to pass everything anyway. A function's use of a global variable violates the stand alone, reusability of a function.

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    8
    Thanks, you gave me an idea.

    Tell me if this will cause any long range problems: I could put the globals in a struct, declare and fill the struct in the entry point function, and just pass the struct around.

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    Sounds fine. It's much cleaner than using globals.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  2. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  3. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  4. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  5. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM