Theory question on C and array passing

Started by
19 comments, last by SiCrane 16 years, 1 month ago
Quote:Original post by rip-off
Quote:Original post by polymorphed
So what you're basically saying, Enigma, is that:
Right?


Exactly.


Well, in theory anyways. In practice ... well, welcome to the world of compiler bugs. In MSVC, if you use:
void func (int myarray[5]) {}void func (int * myarray) {}

in a single file, the compiler will complain that the function already has a body, as it should.

However, if you put the two definitions in different translation units, they will link despite the multiple definitions. The problem is that MSVC name mangles the two function signatures differently, so even though they should be the same function the different prototypes will resolve to different names.

This topic is closed to new replies.

Advertisement