Why are try blocks expensive?

It’s not the block itself that’s expensive, and it’s not even catching an exception, per se, that’s expensive, it’s the runtime unwinding the call stack until it finds a stack frame that can handle the exception. Throwing an exception is pretty light weight, but if the runtime has to walk up six stack frames (i.e. … Read more

Oracle Java code conventions

One option is to use wayback machine, which seems to contain the document (here’s direct link to pdf version). However I would also be interested to find out what Oracle did with it and do they intend to get rid of it. There’s a discussion on Oracle forums about this being raised to OTN support, … Read more

What are the benefits to using anonymous functions instead of named functions for callbacks and parameters in JavaScript event code?

I use anonymous functions for three reasons: If no name is needed because the function is only ever called in one place, then why add a name to whatever namespace you’re in. Anonymous functions are declared inline and inline functions have advantages in that they can access variables in the parent scopes. Yes, you can … Read more

Using true and false in C

Just include <stdbool.h> if your system provides it. That defines a number of macros, including bool, false, and true (defined to _Bool, 0, and 1 respectively). See section 7.16 of C99 for more details.

Are there any coding standards for JavaScript? [closed]

Not exactly what you’re looking for, but (like Doug Crockford’s vids) I think everybody who writes/edits/reviews JS should look at Chris Heilmann’s slides and videos on maintainable javascript. In the slides, slide 127, he says don’t worry so much about style guides/code standards, reformat all code checked in to VCS. Also these: Mozilla JavaScript Tips … Read more

What does ‘foo’ really mean? [closed]

See: RFC 3092: Etymology of “Foo”, D. Eastlake 3rd et al. Quoting only the relevant definitions from that RFC for brevity: Used very generally as a sample name for absolutely anything, esp. programs and files (esp. scratch files). First on the standard list of metasyntactic variables used in syntax examples (bar, baz, qux, quux, corge, … Read more