21st April 21:15
parameter passing between C and C++
In article <firstname.lastname@example.org>, v.Abazarov@attAbi.com
Hmm...while it's difficult for the C++ standard to require it directly,
the struct above is pretty clearly a POD struct, and it does its best to
ensure that POD structs will be layout compatible with C.
[ ... ]
There shouldn't normally be. As I said above, it's virtually impossible
for the C++ standard to come out and directly say it has to be
compatible with C, it comes about as close as the committee figured they
could to doing exactly that.
This can certainly simplify things considerably. Perhaps more to the
point, there's not often much need to mix C and C++ for the simple
reason that at least if you have well-written source code for the C
part, chances are that converting it to compile as C++ will be fairly
trivial. Nonetheless, you don't always have well-written source code to
work with, and in that case, mixing C and C++ is perfectly reasonable
and passing structs back and forth between the two normally works quite
The universe is a figment of its own imagination.