Monday, October 29, 2007

C++ note: operator precedence

Another common trap is the precedence between == and & | ^

The expression a & b == 0 is interpreted as a & (b==0) instead of (a & b) == 0, quite different from a + b == 0.

Conclusion: always add brackets when evaluating the bitwise operators & | ^

Monday, October 01, 2007

Compile log: SRILM

SRILM is a language modelling package, used by the moses translation system. The compilation is quite straightforward, except two things:

1. The current path in the Makefile needs to be changed
2. In common/, there are paths to gcc and g++.
In the first line, GCC_FLAGS might need editing as well. For example, -mtune=pentium3.