Skip to content

{ Category Archives } Tips & Tricks

Java Tip: Be Wary of a New or Cleared java.nio.Buffer

Normally, before writing to a java.nio.Buffer, you should call its clear() method. In a project I am currently working on, I may not be able to process all of the data in a buffer before I need to read into it again. In those cases, compact() should be called instead of clear() so that the […]

Eclipse Tip: How Many Imports?

I do all of my Java development with Eclipse. I’ve been using it for three or four years now, but I still learn new things about it. On the one hand, it’s so easy to use most features that I’ve never read any of the books or other documentation describing them. On the other, there […]

C Tip: Memory Management Macros

One of the things I enjoy about C in comparison to C++ is its simplicity. You rarely have to worry about what’s going on behind the scenes — the compiler isn’t going to play any dirty tricks on you with copy constructors or memory layouts. It’s pretty much a what-you-code-is-what-you-get situation. Even memory management is […]

C Tip: Safe String Manipulation

C-style strings are considered evil by hardcore C++ programmers. They love to talk down on those of us who still use such unsafe and archaic techniques. I can’t count the number of times I’ve seen someone ask for help with a C problem at a game development forum only to be flamed and lectured for […]

General Tip: Coding Exercises

There are times during the course of a project when you just want to bang your head on the desk or toss your monitor through the window, usually because of a bug that is difficult to find. There are other times when you sit staring at the screen with a blank expression while one hand […]