Timeline for Standardly deviated Fibonacci
Current License: CC BY-SA 3.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 2, 2014 at 19:45 | comment | added | Malachi | @Snowbody, I don't know much C++ someone in chat helped me out. you should come join us some time chat.stackexchange.com/rooms/8595/the-2nd-monitor | |
Jul 2, 2014 at 19:44 | history | edited | Malachi | CC BY-SA 3.0 |
fixed some code
|
Jul 2, 2014 at 19:31 | comment | added | Snowbody |
In the line sequenceType = ToUpper[sequenceType]; where is the ToUpper array defined?
|
|
Jul 2, 2014 at 19:06 | comment | added | Malachi | @Edward, good point. I think I would also use a switch there, but I think I would still use the ToUpper function to eliminate extra checks/cases. | |
Jul 2, 2014 at 19:04 | comment | added | Edward |
I think I'd be inclined to code it as a switch statement and use case 'F': and case 'f': . To my eye, that makes it a little easier to identify what is controlling the flow of execution. Speed is likely not an issue after idling millions of CPU cycles waiting for human input, so I don't think I'd bother changing the case of the input.
|
|
Jul 2, 2014 at 18:37 | comment | added | Loki Astari |
@Malachi: Sorry I did not mean change your code. std::toupper() hides that inside its implementation. For ASCII this maps to a simple table lookup. I would keep the std::toupper I was just trying to demonstrate that under normal situations the speed difference is not a major consideration factor.
|
|
Jul 2, 2014 at 18:28 | history | edited | Malachi | CC BY-SA 3.0 |
added 567 characters in body
|
Jul 2, 2014 at 18:21 | comment | added | Loki Astari |
@jiv902: Technically less efficient . Actually I don't know if I would not make that bet. To upper is simply an array access operation. So it boils down to: if (sequenceType == 'F' || sequenceType == 'f') Vs if (ToUpper[sequenceType] == 'F') Thats a very hard one to call. So I would go for the most readable one as my argument.
|
|
Jul 2, 2014 at 15:35 | history | edited | Malachi | CC BY-SA 3.0 |
added 38 characters in body
|
Jul 2, 2014 at 15:33 | comment | added | Malachi | @Jamal, maybe I should have phrased that differently, I meant the Carriage Returns in the code between if statement blocks. | |
Jul 2, 2014 at 15:32 | comment | added | Jamal |
There are not that many newline characters, but it is worth mentioning that std::endl is not needed; "\n" is preferred.
|
|
Jul 2, 2014 at 15:28 | comment | added | jliv902 |
+1 for recommending the use of brackets. Not sure if I agree with the too many newline characters part. For case conversion, there is std::toupper(). It would technically be less efficient performance-wise, but that wouldn't make a difference.
|
|
Jul 2, 2014 at 15:26 | comment | added | Malachi | I respectfully disagree, it is harder to find issues if the code is cluttered and hard to read, writing clean code makes it easier to debug. | |
Jul 2, 2014 at 15:22 | comment | added | DeadMG | Brace style is the least of his problems. This does nothing but focus him on totally the wrong issues. | |
Jul 2, 2014 at 15:07 | history | answered | Malachi | CC BY-SA 3.0 |