-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Per Jessen wrote:
Roger Oberholtzer wrote:
On Wed, 2010-06-02 at 13:19 +0200, Per Jessen wrote:
Roger Oberholtzer wrote:
I have a question about a difference between gcc and g++ in the following:
typedef struct {
const char *CMD_SERVICE, *CMD_TRANSPORT;
} dPavueCnfg;
dPavueCnfg dConfig = {
.CMD_SERVICE = "DPcmd", .CMD_TRANSPORT = "tcp" };
This works with gcc (on Linux and MinGW). But it does not work in g++. So, is this a GNU C-only extension? No, designated initializers belong to C99, but they're not part of C++. D*mn. I am using a 3-rd party library that is c++, and so i am compiling with g++. I usually do not use it. Oh well. I will have to adapt.
I know exactly what you mean - I've recently started using xapian, also C++. I wish there were a g++ switch for enabling their use.
At least I know what this is called: designated initializers. They are a good thing IMHO.
Most definitely - makes the initialization safer and far easier to read.
I thought they were GNU extensions. So if they are C99, other compilers might support them? As we have really extended our use of them, I was thinking we were effectively deciding that we were going to stick with GNU compilers.
I'm pretty certain other compilers such as e.g the Intel and the Pathscale compilers will support C99 too.
/Per Jessen, Zürich
I think I have come across a couple of references suggesting that an object constructor could supply equivalent functionality. The above construct is thought by some to be functionally problematic within the C++ OO model. (IIRC there is a school of thought that data structures are best implemented as data objects in OOP anyway). - -- ============================================================================== I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone. Bjarne Stroustrup ============================================================================== -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAkwHkBUACgkQasN0sSnLmgLTnQCfVEl+Ky9yuaq10CuHCxqlcQbc K+0An0JE8HzHfaN6HT+ZuP0uM022wRcP =1bHK -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org