Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Similar bug:

  int i = 10;
  int *p = &i;

  int j = 100/i; // j==10 right? right

  int k = 100/*p; // k==10 right?
That last line doesn't compile.


Use spaces between arithmetic operators. You've already got them around the = sign. It looks much better, and prevents this problem:

  int i = 10;
  int *p = &i;

  int j = 100 / i; // j==10 right? right

  int k = 100 / *p; // k==10 right? right
Also, any decent syntax highlighter would have caught the latter problem. The problem in the blog post was much more subtle, because most (all?) syntax highlighters won't catch it.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: