Программы на C++. Форум разработчиков
Anonymous
Для функции, объявленной вперед, разрешен неправильный тип возвращаемого значения: почему здесь нет ошибки компоновщика?
Сообщение
Anonymous » 01 май 2024, 17:51
Код: Выделить всё
$ 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
Код: Выделить всё
#include
using namespace std;
static int x = 5053;
void f2();
int main() {
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78411836/incorrect-return-type-allowed-for-forward-declared-function-why-is-there-no-lin[/url]
1714575096
Anonymous
[code]$ 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 [/code] a.cc [code]#include using namespace std; static int x = 5053; void f2(); int main() { cout Подробнее здесь: [url]https://stackoverflow.com/questions/78411836/incorrect-return-type-allowed-for-forward-declared-function-why-is-there-no-lin[/url]