On Thu, Jun 03, 2010 at 04:23:59PM +0200, Per Jessen wrote:
your struct becomes a class
You can keep it a struct...
class xxxxxx {
public: const char *CMD_SERVICE, *CMD_TRANSPORT;
// constructor xxxxxxx( char *s, char *t):CMD_SERVICE(s),CMD_TRANSPORT(t) {}; }
When you instantiate the class:
xxxxxx dConfig ( "DPcmd", "tcp" );
...but this is strictly _worse_ than using C89-style initializer - you get the same information value and an extra need to write a constructor and keep it up to date. The poin of C99-style initializers is that you (i) explicitly annotate values by the fields they initialize and (ii) can leave some fields uninitialized. I think C++ simply has no equivalent functionality that would allow for (i) and (ii)? -- Petr "Pasky" Baudis The true meaning of life is to plant a tree under whose shade you will never sit. -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org