Archive for the 'Programming' Category
More fun with Java (scope and duplicates)
I thought this was interesting… In Java, a block scoped variable may conflict with a local variable declared later in method scope, but not previously (as shown below):
class A{ public static void main(String args[]){ {int k = 5;} int k = 12; //this is OK {int k = 22;}//this is not.... } }
This is not the same as C++ where this compiles happily:
int main(){ {int i;} int i; {int i;} return 0; }
Usually C++ has the more obscure behavior….
No commentsProtected within Java Enums
I just noticed that java enums allow protected member variables and methods. Why is this interesting? Can you think of any code that might actually make use of a protected member in an enum (as opposed to private)? Example after the jump (warning, not practical…).
Read more
SWIG, Java, and JRuby
Providing a robust, maintainable, and interactive interface to your C/C++ application can be a challenge, but I’ve found that a combination of SWIG, Java, and JRuby (or Jython if you prefer) makes for a very powerful combination.
Read more
Why is XML Better?
Why is XML better than custom internal formats? Isn’t a non-standard set of XML tags basically equivalent to a custom format when using data internally to an application? Absolutely not, and here is why.
Read more
Spirit Vs. Lex/yacc/et al.
What are the differences and when should I use one or the other?
Read more
Writing a custom check macro for the BOOST test library
In this article I demonstrate how to write your own check macros for the boost test library (not guaranteed to work in the future)
Full source code for this example can be downloaded here.
Read more