https://rentry.org/PPP2_p162b ⎗ ✓ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20// Code derived from Stroustrup's PPP2 book // § 5.9.1 Practical debug advice // -and beginning on p 162 #include <iostream> using std::cerr; int my_fct(int a, double d) { int res = 0; cerr << "my_fct(" << a << "," << d << ")\n"; // . . . misbehaving code here . . . cerr << "my_fct() returns " << res << '\n'; return res; } int main() { my_fct(1, 2.2); } build & run: g++ -std=c++20 -O2 -Wall -pedantic ./ch_05/main_p162b.cpp && ./a.out sauce: Bjarne Stroustrup's PPP2 textbook /robowaifu/'s official C++ learning textbook thread Prev • Up • Next