On Apr 7, 9:54 pm, "Mike Wahler" <mkwah...@mkwahler.netwrote:
"2b|!2b==?" <r...@your.box.comwrote in message
news:Lb******************************@bt.com...
typedef struct llist_entry_s llist_entry; /* opaque type */
struct llist_entry_s
{
llist_entry * next;
char * keyword;
char * value;
llist_entry() :next(0), keyword(0), value(0)
{
}
};
You don't say what compiler errors you get.
The above code compiles successfully for me with VC++.
It shouldn't. G++ says:
ctor.cc:16: error: ISO C++ forbids declaration of 'llist_entry'
with no type
ctor.cc:18: error: declaration of 'int
llist_entry_s::llist_entry()'
ctor.cc:8: error: changes meaning of 'llist_entry' from 'typedef
struct llist_entry_s llist_entry'
ctor.cc: In member function 'int llist_entry_s::llist_entry()':
ctor.cc:16: error: only constructors take base initializers
Which is what I'd expect.
BTW you don't need that typedef. You could write it
like this:
struct llist_entry
{
llist_entry * next;
char * keyword;
char * value;
llist_entry() :next(0), keyword(0), value(0)
{
}
};
That would be more idiomatic C++, of course.
--
James Kanze (Gabi Software) email:
ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34