On Thu, 2010-06-03 at 16:23 +0200, Per Jessen wrote:
Roger Oberholtzer wrote:
What would be the equivalent functionality in g++? I am not a c++ programmer, so a concrete example is needed!
The C version of one use is this:
typedef struct {
const char *CMD_SERVICE, *CMD_TRANSPORT;
} dPavueCnfg;
dPavueCnfg dConfig = {
.CMD_SERVICE = "DPcmd", .CMD_TRANSPORT = "tcp" };
What would I do in C++?
It's been about ten years since I did C++ regularly, but let's try:
your struct becomes a class
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" );
/Per Jessen, Zürich
The thing is, I do not want to use it from c++. It is used in C code. The whole application is C. I am just forced to use the g++ compiler because some include files for a library I must use (an interface to some GigaEvision cameras) use c++ definitions. Even though the stuff I am using from them are all C. Such is life. -- Roger Oberholtzer OPQ Systems / Ramböll RST Ramböll Sverige AB Krukmakargatan 21 P.O. Box 17009 SE-104 62 Stockholm, Sweden Office: Int +46 10-615 60 20 Mobile: Int +46 70-815 1696 -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org