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

Looks like standard Google C++ coding style to me.

Honestly, excessive cleverness does not generally pass code review @ Google. Especially something that would get this many eyes.




Honestly I'm most surprised they haven't replaced all the c-isms already. Seeing raw char pointers and strbrk is...weird.


Yes as a Googler, I'd probably flag that in review.

But it being old and critical, I'd also be wary of major changes.


I wonder if anyone ever found/accidentally triggered a buffer overflow in this or another part of googlebot.

I imagine these days it’s been incredibly hardened and is additionally sandboxed. But back in the day?


> Honestly, excessive cleverness does not generally pass code review @ Google.

And yet the Google style guide literally says: "Assume the person reading the code knows Python better than you do."

https://github.com/google/styleguide/blob/gh-pages/pyguide.m...


You're very much taking that out of context. Read the entire section. There's a grand total of 7 sentences in there. It literally says:

If you're going to have to explain it at the next code review, you should comment it now. Complicated operations get a few lines of comments before the operations commence. Non-obvious ones get comments at the end of the line.

The section you're quoting says:

On the other hand, never describe the code. Assume the person reading the code knows Python (though not what you're trying to do) better than you do.


I think you might be misreading the meaning of this? If the person reviewing knows the language better than you, they they are hopefully less likely to tolerate "clever code", not more.

By "clever code" we're talking about weird unidiomatic tricks and hacks that maybe writes things in a slightly shorter or in a fractionally more (unnecessarily) optimised way, and makes you feel clever, but makes it harder and more time consuming for anyone else to understand what your code is doing, or verify that it's actually doing what it's supposed to.




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

Search: