more multiple file problems

This is a discussion on more multiple file problems within the C++ Programming forums, part of the General Programming Boards category; I swear I've tried everything at this point, but no matter what I do, the only way to avoid errors ...

  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,662
    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,662
    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, 05: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, 01:44 PM
  3. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 02:04 PM
  4. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 01: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21