Someone came into #C++ this evening with what turned out to be a very simple compiler error.

In header.c:

In main.c:

The error? "Conversion from std::vector<MyObjCluster, std::allocator<MyObjCluster> >* to non-scalar type std::vector<MyObjCluster, std::allocator<MyObjCluster> > requested."

And C++'s confusing type system strikes once again.

The guy was confused, thinking that you need the '&' in both the function signature and the calling line to pass by reference, and in this case the solution is of course to simply omit the '&' before B in main.c.

"Messy type system?", you ask dubiously. Here's a typedef that will have the token myFunctionPointer represent the function void* myFunction(int a, char* b):

Yes, it's a mess. Add to that the fact that the asterisk has two — largely distinct — meanings (or three if you count multiplication on top of pointer-type and dereferencing) as does ampersand for just the same reason, which is what started this particular topic off.

Discuss.