I did some searching around once I realized that what I really wanted was a global replace, and I just knew that vim must have macros with bindings for different states of the application, and with much persistence I was proven correct! Check it out:
autocmd BufWritePre * :%s/\s*$//
I put that in my ~/.vimrc file, and it makes me happy. It does a global replace before writing the buffer. Notice that it will do this for every file you write. If you want to only have it alter C files, for example, change the line to look like this:
autocmd BufWritePre *.c :%s/\s*$//
From what I've read, that should work fine.