Given the following code snippet:
#include <string>
#include <iostream>
int main()
{
std::string prefix("->"), middle(), suffix("<-");
std::cout << "Test: " << prefix << middle << suffix << std::endl;
return 0;
}
The advanced C++ programmer will immediately see that middle()
is not calling std::string
's default ctor, instead it's a function declaration.
What's interesting though: Why does gcc produce the following output:
Test: ->1<-
in contrast to Visual Studio's linker error? Does anybody know what's going on here?