On Thu, 2005-03-31 at 10:20 +0100, Tiago Jorge wrote:
When i come to build the stubs it with g++, it gives me error in the lines that fill the exception in the call, more precisely here:
l4_umword_t _exception = ((dice_CORBA_exception_type){ _s: { .major = _dice_corba_env->major, .repos_id = _dice_corba_env->repos_id }})._raw;
it says:
/home/tiago/l4/pkg/ipc_example/server/src/hiworld-server.cc:17: error: parse error before `.' token
how can i adapt this line to C++ or... where is the "error".
This is a DICE bug -- or rather, an unintended C++ incompatibility.
The C99 standard introduced this syntax for "struct initialization by name". It has not been accepted into the C++ language (yet), and I sincerely hope that it will never be. The C99 specification of this behavior is extremely complex and filled with ambiguity. It fails, for example, to specify the order of initialization, and it is legal using the by name initializers to initialize a field twice -- once in the old style and a second time using the new syntax. The results are both unchecked and unspecified.
Because this area of the C99 standard is exceedingly complicated, I would strongly urge the DICE team to avoid use of this feature. There is nothing conceptually wrong with it, but current compilers cannot be relied on to implement this feature correctly in complex cases. Using this feature is therefore inadvisable *even* if C is the only intended target langauge.
Avoiding it would incidentally avoid a gratuitous C++ incompatibility, and would help ensure that all initializers are completely specified by making it impossible to omit fields accidentally from the initialization specification.
Jonathan Shapiro