Tag Archives: approach

Best way to detect integer overflow

On assignment C-bootcamp1, we were asked to write a factorial function.
The difficult part is how to detect integer overflow.

Defective idea
After some research with Google, I found a post on StackOverflow.com, which guides me to fault. I can’t find the original post though.

It says, when integer overflow occurs, the result(n * (n-1)) is smaller than n.
Because, int, on a 32 bit machine, is 32bits, the return value is truncated when it needs more bits, namely when it is Continue reading

Google in China

GoogleGoogle’s statement on Jan 12, 2010: A new approach to China

1. Why did Google issue the statement of January 12th?

  • To be clear they are facing difficulties in their efforts made to provide great services to the Chinese users
  • To tell people that they believe in and insist on freedom of speech and democracy on the web Continue reading