Stuart Bailey stuart@linusoft.co.uk writes:
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.
You are thinking of a constructor, which is part of C++, not of C. You could indeed use that to tie names to initial values, though it still has the problem that you have to list the names twice, opening up scope for error.
GCC/C99 designated initializer syntax avoids the C++ dependency but has the same flaw.
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.
This is very silly.