Fix C++11 compile errors on Mac OS X 10.9 and LLVM 5.1.

This fixes four build errors on Mac OS X 10.9 (LLVM 5.1) when using C++11.

To repro the compile errors:
> make clean &&  CFLAGS=-std=c++11 make
nn.cc:72:27: error: non-constant-expression cannot be narrowed from type 'int32_t' (aka 'int') to
      'uint32_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
example.cc:115:20: error: non-constant-expression cannot be narrowed from type 'unsigned long' to
      'uint32_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
allreduce.cc:158:59: error: invalid operands to binary expression ('__bind<int &, sockaddr *, unsigned
      long>' and 'int')
spanning_tree.cc:155:55: error: invalid operands to binary expression ('__bind<int &, sockaddr *,
      unsigned long>' and 'int')

> clang++ --version
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.2.0
Thread model: posix