diff options
| author | hybrid <hybrid@hybridlabs.cc> | 2026-08-21 17:26:49 +0300 |
|---|---|---|
| committer | hybrid <hybrid@hybridlabs.cc> | 2026-08-21 17:26:49 +0300 |
| commit | afd71cacbf324b2898220437c10b4db4228b70ce (patch) | |
| tree | 02a646222cf880cd1ad87a283d8e2c5e2bbca8bb /src/chapter1/lesson4/unused_variables.cpp | |
| download | learncpp-afd71cacbf324b2898220437c10b4db4228b70ce.tar.gz learncpp-afd71cacbf324b2898220437c10b4db4228b70ce.tar.bz2 learncpp-afd71cacbf324b2898220437c10b4db4228b70ce.zip | |
add: alot
Diffstat (limited to '')
| -rw-r--r-- | src/chapter1/lesson4/unused_variables.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/chapter1/lesson4/unused_variables.cpp b/src/chapter1/lesson4/unused_variables.cpp new file mode 100644 index 0000000..52d724f --- /dev/null +++ b/src/chapter1/lesson4/unused_variables.cpp @@ -0,0 +1,15 @@ +#include <iostream> + +int main() +{ + [[maybe_unused]] double pi { 3.14159 }; // Don't complain if pi is unused + [[maybe_unused]] double gravity { 9.8 }; // Don't complain if gravity is unused + [[maybe_unused]] double phi { 1.61803 }; // Don't complain if phi is unused + + std::cout << pi << '\n'; + std::cout << phi << '\n'; + + // The compiler will no longer warn about gravity not being used + + return 0; +} |
