Hacker News new | past | comments | ask | show | jobs | submit login

Yeah, I felt that in cases (like when doing COM programming) where the true result is almost always returned in a parameter and the status code as the return value, it made a lot of sense to me to combine those into one line wherever they appeared. But, like the article says, this is a lesser-known operator. In libc style, a similar thing makes sense, e.g.

   return errno=ENOENT, (FILE*)0;
I don't know if anyone uses this style.

In K&R, they say that it's mostly used in for loops, such as

   for (i = 0, j = strlen(s) - 1; i < j; i++, j--) ...
So that is where I use it now.



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

Search: