|
Suspicious Dish posted:I have one case where I use goto; matched with a label, out: Another nice feature is that execution falls through labels nicely, so you can do more complicated cleanup like this.
|
# ¿ Apr 19, 2012 22:06 |
|
|
# ¿ Apr 24, 2024 10:48 |
|
I like the way Go handles switch statements. It's sort of the reverse of C; breaking at the end of a case is the default, and there is a fallthrough keyword if you actually want to continue to the next case.
|
# ¿ Jul 11, 2012 07:51 |
|
seiken posted:Obviously there are many faster ways to do it but missed optimizations like that probably aren't nearly so much of a horror as the other fundamental ones present (like huge sections of pointless code). You may as well say it's a horror not to implement AKS in baby's first python function. Actually implementing AKS would be a horror. It's extraordinarily slow and complex. Everyone just uses Miller or Miller-Rabin instead.
|
# ¿ Jan 2, 2013 23:23 |
|
The *Impl "pattern" is also used in Java to help out with unit testing. The *Impl class isn't actually the only implementation: tests define mock implementations and use those to avoid dependencies on other parts of the application. You need the interface because the mock libraries use java.lang.reflect.Proxy under the hood which can only implement interfaces, not extend classes.
|
# ¿ Mar 31, 2013 04:29 |
|
Arcsech posted:Why are VLAs bad? I haven't really run into them before, so honest question. It makes it really easy to run out of stack if you aren't careful.
|
# ¿ Apr 17, 2013 02:16 |
|
zergstain posted:Most of the issues I fix aren't like that, but that one is pretty common. They also cast the free() argument to char *, what would make someone think this is necessary? I believe that in the pre ANSI-C days, void * wasn't a type so free took a char * which you'd need to manually cast to. It's the same reason that some people still do this cast code:
|
# ¿ May 9, 2013 18:43 |
|
nielsm posted:So an infinite recursion takes how long to crash? Not very long: code:
|
# ¿ May 10, 2013 00:27 |
|
Volte posted:What, the exit(1) is only for when an impossible thing happens and it aborts the program. It would be more appropriate to assert(3) or abort(3) there. Rothon fucked around with this message at 17:53 on Jul 27, 2013 |
# ¿ Jul 27, 2013 17:49 |
|
Doctor w-rw-rw- posted:Speaking of security shame, here's a syllabus for Berkeley's (computer science) security class this semester: That has to be some elaborate metaphor for overly burdensome security practices. It's just too nuts.
|
# ¿ Aug 30, 2013 04:45 |
|
|
# ¿ Apr 24, 2024 10:48 |
|
Ender.uNF posted:On a slightly different note, I've said it before but when I first saw that a message to nil in Objective-C does nothing and returns zero I thought it was the dumbest thing ever. Now I realize that's the way all languages should work. 99.9% of the time when some reference is null, I just want to ignore it and/or skip that section of code. It is extremely rare that I want to throw an exception, assert, crash, etc. The return value is only *usually* 0. If you call something that returns a struct by value that's larger than a register, the contents of it are undefined!
|
# ¿ Oct 10, 2013 17:17 |