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

https://github.com/ir33k/gmi100/blob/master/gmi100.c#L27 definitely threw me for a loop until I realized it was a line saving trick. It would be more readable to save lines elsewhere by exploiting the comma operator instead of essentially cramming irrelevant statements into a conditional.

For example:

  addr.sin_family = AF_INET;
  addr.sin_port = htons(1965);
Could become:

  addr.sin_family = AF_INET, addr.sin_port = htons(1965);


Ah yes, there are couple of line saving tricks like that. Mostly in for loops.

Thanks for suggestion. I will go through code again to see if I can save more space with normal code.

Actually that was my workflow. Each time I managed to write something in simpler way I reverted few tricks.




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

Search: