What are everyones thoughts on hints (H2077) for value assigned to the result of a function that is never used. I get these often from initializing result to something before I ever write any code.
What are everyones thoughts on hints (H2077) for value assigned to the result of a function that is never used. I get these often from initializing result to something before I ever write any code.
Does anyone do something similar, do you ignore the hint or remove the intialization?
Does anyone do something similar, do you ignore the hint or remove the intialization?
Simon Stuart Yes, I realize we're not talking grammar rules, but the comment was half in jest. Since the optimization rules aren't defined to us, the area is grey, at best.
ReplyDeletePersonally I prefer guard clauses over initializing the result variable.
ReplyDeleteif SomeCondition then
Exit(false) //nil, emptystr, whatever
Kenneth Cochran You might want to consider the TArgument class in the Delphi Spring Framework if you like guard clauses.
ReplyDelete