<story><title>Gangnam Style breaks YouTube viewer count</title><url>https://plus.google.com/+youtube/posts/BUXfdWqu86Q</url></story><parent_chain></parent_chain><comment><author>gavinpc</author><text>Can&amp;#x27;t quite tell if this is a joke, but here&amp;#x27;s a related &amp;quot;story about a bug&amp;quot; from Doug Crockford [0]:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    I made a bug once, and I need to tell you about it.  So, in 2001, I wrote a
    reference library for JSON, in Java, and in it, I had this line
    
        private int index
    
    that created a variable called &amp;quot;index&amp;quot; which counted the number of characters in
    the JSON text that we were parsing, and it was used to produce an error message.
    Last year, I got a bug report from somebody.  It turns out that they had a JSON
    text which was several gigabytes in size, and they had a syntax error past two
    gigabytes, and my JSON library did not properly report where the error was — it
    was off by two gigabytes, which, that&amp;#x27;s kind of a big error, isn&amp;#x27;t it?  And the
    reason was, I used an int.
    
    Now, I can justify my choice in doing that.  At the time that I did it, two
    gigabytes was a really big disk drive, and my use of JSON still is very small
    messages.  My JSON messages are rarely bigger than a couple of K.  And — a
    couple gigs, yeah that&amp;#x27;s about a thousand times bigger than I need, I should be
    all right.  No, turns out it wasn&amp;#x27;t enough.
    
    You might think well, one bug in 12 years you&amp;#x27;re doing pretty good.  And I&amp;#x27;m
    saying no, that&amp;#x27;s not good enough.  I want my programs to be perfect.  I don&amp;#x27;t
    want anything to go wrong.  And in this case it went wrong simply because *Java
    gave me a choice that I didn&amp;#x27;t need, and I made the wrong choice*.
&lt;/code&gt;&lt;/pre&gt;
[0] &lt;a href=&quot;https://www.youtube.com/watch?v=bo36MrBfTk4&amp;amp;t=38m&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.youtube.com&amp;#x2F;watch?v=bo36MrBfTk4&amp;amp;t=38m&lt;/a&gt;&lt;p&gt;EDIT: is there a reference for formatting comments?  I&amp;#x27;ve never been able to find one.</text></comment>
<story><title>Gangnam Style breaks YouTube viewer count</title><url>https://plus.google.com/+youtube/posts/BUXfdWqu86Q</url></story><parent_chain></parent_chain><comment><author>xanderjanz</author><text>Should have gone with unsigned ints, YouTube!&lt;p&gt;EDIT: Which is the solution they apparently implemented, converting signed to unsigned at some higher layer.</text></comment>