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

Yea according to a reddit post from a Googler this was more of a staged easter egg then a real bug. Google coding styles actually prohibit the use of unsigned integers in C++ code.


Interesting, until very recently I was writing a whole bunch of C++ at Google but I can't recall any such restriction. Most internal data structures at Google are expressed as protocol buffers and surely these support unsigned integers. In fact if someone suggested that a view counter should be signed that would invite a snark (kind of Google's specialty) like 'can it ever be negative'?

[One problem with unsigned integers in protocol buffers is that some supported languages like Python have no concept of signed/unsigned integers. Which is why for example Thrift does not support that distinction. This has nothing to do with C++ though.]


> One problem with unsigned integers in protocol buffers is that some supported languages like Python have no concept of signed/unsigned integers.

You can still implement range checks to enforce that the numbers are in the correct domain. It's not that much of a problem.

This is more of a problem in a statically typed language like Java, because it means there is no native data type to map protobuf's unsigned types to. In Python this doesn't matter as much because numbers will automatically promote themselves to bigints.


Why not both? Fix the bug, then celebrate.




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

Search: