LINUX.ORG.RU

История изменений

Исправление xaizek, (текущая версия) :

$ g++ -Wall -Wextra t.cpp -fno-diagnostics-show-caret
t.cpp: In member function ‘boxed_value& boxed_value::operator=(const boxed_value&)’:
t.cpp:21:1: warning: no return statement in function returning non-void [-Wreturn-type]
t.cpp: In function ‘int test(const shape&, const shape&)’:
t.cpp:25:23: error: no match for ‘operator*’ in ‘width(((* & s1), shape())) * height(((* & s1), shape()))’ (operand types are ‘boxed_value’ and ‘boxed_value’)
t.cpp:25:48: error: no match for ‘operator*’ in ‘width(((* & s2), shape())) * height(((* & s2), shape()))’ (operand types are ‘boxed_value’ and ‘boxed_value’)
t.cpp: In function ‘int main()’:
t.cpp:33:15: error: cannot convert ‘bool’ to ‘void*’
t.cpp:28:19: note:   initializing argument 2 of ‘void callee(int, void*, int)’
t.cpp:34:5: error: ‘printf’ was not declared in this scope
t.cpp:34:5: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?

И это не стиль шланга, а стиль какого-то старого компилятора Паскаля.

Исправление xaizek, :

$ g++ -Wall -Wextra t.cpp -fno-diagnostics-show-caret
t.cpp: In member function ‘boxed_value& boxed_value::operator=(const boxed_value&)’:
t.cpp:21:1: warning: no return statement in function returning non-void [-Wreturn-type]
t.cpp: In function ‘int test(const shape&, const shape&)’:
t.cpp:25:23: error: no match for ‘operator*’ in ‘width(((* & s1), shape())) * height(((* & s1), shape()))’ (operand types are ‘boxed_value’ and ‘boxed_value’)
t.cpp:25:48: error: no match for ‘operator*’ in ‘width(((* & s2), shape())) * height(((* & s2), shape()))’ (operand types are ‘boxed_value’ and ‘boxed_value’)
t.cpp: In function ‘int main()’:
t.cpp:33:15: error: cannot convert ‘bool’ to ‘void*’
t.cpp:28:19: note:   initializing argument 2 of ‘void callee(int, void*, int)’
t.cpp:34:5: error: ‘printf’ was not declared in this scope
t.cpp:34:5: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?

Исходная версия xaizek, :

$ g++ -Wall -Wextra t.cpp -fno-diagnostics-show-line-numbers -fno-diagnostics-show-labels -fno-diagnostics-show-caret
t.cpp: In member function ‘boxed_value& boxed_value::operator=(const boxed_value&)’:
t.cpp:21:1: warning: no return statement in function returning non-void [-Wreturn-type]
t.cpp: In function ‘int test(const shape&, const shape&)’:
t.cpp:25:23: error: no match for ‘operator*’ in ‘width(((* & s1), shape())) * height(((* & s1), shape()))’ (operand types are ‘boxed_value’ and ‘boxed_value’)
t.cpp:25:48: error: no match for ‘operator*’ in ‘width(((* & s2), shape())) * height(((* & s2), shape()))’ (operand types are ‘boxed_value’ and ‘boxed_value’)
t.cpp: In function ‘int main()’:
t.cpp:33:15: error: cannot convert ‘bool’ to ‘void*’
t.cpp:28:19: note:   initializing argument 2 of ‘void callee(int, void*, int)’
t.cpp:34:5: error: ‘printf’ was not declared in this scope
t.cpp:34:5: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?