Or maybe arguing over the nanoseconds one's code takes over the other guy's code. Been in this argument too many times and it's one of the reasons I'm leaving coding for good.Nothing says I have a huge programmer ego like dumping shitty/unsafe code on a forum called "useless forums"
Go look at the code I posted.
Damn did you cats get triggered. I didn't really look at that damn code, just throwing in a little fun with an array is simpler/cleaner.Go look at the code I posted.
First one is gonna be as slow or slower than the original if/then/else code that got posted, which will likely compile to the same machine code as a switch statement anyway. Second code was arguably fast but unsafe as shit, and looking at it again, doesn't even work. Third code is even unsafer, and requires a 26^6 (308.9M entry) lookup table.
And the purpose of those three bits of code? to convert a state to an abbreviation. How many times does a function like that actually get hit? Is it going to remove 25% of the servers out of a data center and save megawatts of power to optimize a dumb function like that?
but nooooo, this is a SERIOUS argument about NANOSECONDS