Re: lulz
Posted: Thu Nov 25, 2010 6:01 pm
Any questions?
I have seen it in code for drivers and a microkernel for an embedded platform, haha.avansc wrote:I dont wanna get involved in this little tiff, but wtf is "very legit, low-level C code" ?
Arce wrote:Allow me to reiterate:K-Bal wrote:There is more about code than efficiency and correctness. How about readability, maintainability, modularity? I think the examples in this thread are quite understandable, but I wanted to point that out.andThe reason for all the (unnecessary?) ternary statements is that it allows you to essentially ignore the "design" part and just speed code, "hacking" in extra conditions wherever necessary.as well asBut the main thing I was referring to was this garbage:Also,Did that really save you any time?
Of course.'Hell no! I have seen some very legit, low-level C code using that kind of embedded ternary statement. I think that's perfectly acceptable.
was referring tohence theCode: Select all
char letter = ((average >= 90 && average<= 100 ) ? 'A' : ( average >= 80 && average< 90 ) ? 'B' : ( average >= 70 && average< 80 ) ? 'C' : ( average >= 60 && average< 70 ) ? 'D' : ( average < 60 ) ? 'F' : 'X') ;
In regard tokind of embedded ternary statement.Irrelevant? No, non-nonsensical and obviously the retort of somebody who misunderstood the original defense, or atleast drew wild deductions about the wholeI was also unaware of the fact that Arce was required to write in straight CI have seen some very legit, low-level C code
to imply anybody implied anything about nested ternaries requiring straight C?
Clearly.I am also a naive fool
But not for this reason. Perhaps you missed the "lighthearted vibe" of the topic, emphasized byfor assuming that including an abundance of the code that Arce's professor is specifically against, is clearly insulting their judgment.
,as "x-treeme nerd!",pretty nifty, nonetheless.,The ternary operator RULLZ! You should get a +1 for every ternary you use!pointed out byPlease, direct your attention to the "showResults" mess, and tell me if you think she's going to flunk me?,Wow, my post might have warranted a sarcastic one-liner, but an entire paragraph complete with multiple emoticons to emphasize the sarcasm?
and under the circumstances ofyet somehow managed to deduce that I was in some way intentionally trying to insult my instructor?I found myself waking up 15 minutes before an extra credit assignment was due
Impressively, you manage to contradict your own logic herewithIt is apparent that Arce's professor is dimwitted for enforcing that her students produce clean, readable and maintainable code.; would it not be illogical to argue the simplicity of a "bare essential" course, then swing your own definitions ofEspecially in a seemingly basic programming course, where the prerequisites would surely be a knowledge of the bare essentials of the language., which is, by and large, a complex topic beyond the scope ofreadable and maintainable code.especially when, "showing off" the many uses of a ternary would be clearly demonstrating yourknowledge of the bare essentials of the language?knowledge of the bare essentials of the language
And, finally,this is not necessarily true in the circumstances of some very legit, low-level C code or cases of embedded systems (thought, obviously, this is not applicable here, and we're just arguing for the sake of argument. ;p )There is more about code than efficiency and correctness. How about readability, maintainability, modularity? I think the examples in this thread are quite understandable, but I wanted to point that out.
Done.Feel free to correct me, if I am wrong.
Since the OP requested it.Arce wrote:Locked for the sake of sanity.