Relative Content

Tag Archive for c++return-typeforward-declaration

Why isn’t a linker error thrown in this particular scenario?

$ g++ –version Configured with: –prefix=/Library/Developer/CommandLineTools/usr –with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 Apple clang version 12.0.0 (clang-1200.0.32.29) Target: x86_64-apple-darwin23.4.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin a.cc $ cat a.cc #include<iostream> using namespace std; static int x = 5053; void f2(); int main() { cout << “a: ” << x << endl; f2(); return 0; } b.cc $ cat b.cc #include<iostream> using […]