RPN Calculator for C++

This bit of code here Needs to move to main and slightly transform And that means you’ll need to rethink this loop while(input != “=”) You’re really close. Two suggestions: You can optimize the isOperator function. And since you know there is only one character in the operator, you can use something more elegant than if/else … Read more

Debug vs Release in CMake

With CMake, it’s generally recommended to do an “out of source” build. Create your CMakeLists.txt in the root of your project. Then from the root of your project: And for Debug (again from the root of your project): Release / Debug will add the appropriate flags for your compiler. There are also RelWithDebInfo and MinSizeRel build configurations. You can modify/add to the flags by specifying a toolchain file in … Read more

RPN Calculator for C++

This bit of code here Needs to move to main and slightly transform And that means you’ll need to rethink this loop while(input != “=”) You’re really close. Two suggestions: You can optimize the isOperator function. And since you know there is only one character in the operator, you can use something more elegant than if/else … Read more

Debug vs Release in CMake

With CMake, it’s generally recommended to do an “out of source” build. Create your CMakeLists.txt in the root of your project. Then from the root of your project: And for Debug (again from the root of your project): Release / Debug will add the appropriate flags for your compiler. There are also RelWithDebInfo and MinSizeRel build configurations. You can modify/add to the flags by specifying a toolchain file in … Read more

Passing as const and by reference – Worth it?

Passing by const reference is the preferred way to pass around objects as a smart alternative to pass-by-value. When you pass by const reference, you take the argument in by reference (avoiding making any copies of it), but cannot make any changes to the original object (much as would happen when you would take the parameters in by value). … Read more