If you use a struct to contain the configuration you avoid many of the nasties of globals, however initialising the values is messy IMHO. You get stuff like:-
In a header file:-
struct ClockConfig { int xsize; int ysize; char bgcolor[COL_SIZE]; char fgcolor[COL_SIZE]; bool iconic; ... ... ... etc. };
and then, in the code somewhere:-
struct ClockConfig clockCfg = { 54, 54, "#123456", "#FFFFFF", FALSE, ... ... .. etc. };
Which, to my mind, is truly horrible and difficult to maintain because you have to be very careful to maintain the one-to-one correspondence between the initialisation values and the struct. Commenting will of course help but it again represents duplicated information which really shouldn't be necessary. Yes, but as far as I can remember (and I may be verging on C++), you can have functions within a struct. Therefore, you could create an initialisation function, with well named parameters (with defaults), that will setup the struct for you. Although you will still have a long parameter list. Unfortunately, I can't remeber the syntax - and I can't find any of my C books to reference. But basically, a C++ class is essentially a structure whose members are by default private rather than public as in structures.
Stuart -- --------------------------------------- Stuart Bailey BSc (hons) CEng CITP MBCS LinuSoft (Proprietor) Linux Specialist (01953) 601294 (07778) 383739 http://www.linusoft.co.uk ---------------------------------------- ********************************************************************** This email and any files transmitted with it are confidential. If you are not the intended recipient, please email postmaster@linusoft.co.uk immediately. You should not copy or use this email or attachments for any purpose nor disclose their contents to any other person. NO BINDING CONTRACT WILL RESULT FROM THIS E-MAIL UNTIL SUCH TIME AS A WRITTEN DOCUMENT IS SIGNED ON BEHALF OF LinuSoft. LinuSoft cannot accept any responsibility for the completeness or accuracy of this message as it has been transmitted over public networks. *************************************************************************