Gotcha.
I would never try and be this 'clever' in an actual program I was writing. I understand the need to simplify things in certain cases, but especially in a case like this where the stack is barely even being touched, it's really making things more complicated for the programmer as well as anyone maintaining the code.
In discrete structures, though, it is a major part of the curriculum to simplify decision trees and statements with equivalencies. In that regard, this exercise has its uses. Especially as the next classes are assembly language and advanced data structures, which I'm told will be full of shite like this.
I equate it to creating your own linked list instead of using STL. I will hopefully never ever have to create a linked list ever again by creating my own node class/pointers. It is useful, however, to know what the STL is doing when you make a dynamic list.
I would never try and be this 'clever' in an actual program I was writing. I understand the need to simplify things in certain cases, but especially in a case like this where the stack is barely even being touched, it's really making things more complicated for the programmer as well as anyone maintaining the code.
In discrete structures, though, it is a major part of the curriculum to simplify decision trees and statements with equivalencies. In that regard, this exercise has its uses. Especially as the next classes are assembly language and advanced data structures, which I'm told will be full of shite like this.
I equate it to creating your own linked list instead of using STL. I will hopefully never ever have to create a linked list ever again by creating my own node class/pointers. It is useful, however, to know what the STL is doing when you make a dynamic list.
"There remain four irreducible objections to religious faith: that it wholly misrepresents the origins of man and the cosmos, that because of this original error it manages to combine the maximum servility with the maximum of solipsism, that it is both the result and the cause of dangerous sexual repression, and that it is ultimately grounded on wish-thinking." ~Christopher Hitchens, god is not Great
PM me your email address to join the Slack chat! I'll give you a taco(or five) if you join! --->There's an app and everything!<---
PM me your email address to join the Slack chat! I'll give you a taco(or five) if you join! --->There's an app and everything!<---