Re:Falsehoods Programmers Believe About Phone Numbers
by jdavis703 on Saturday March 19, 2016 @10:52PM
(#11321574)
Also my U.S. phone number used to be 703-6XX-XXXX (digits omitted for privacy). That's not going to work if you store it as a 32-bit integer (when I was a dumb college student I made a similar mistake, and spent a couple of minutes scratching my head over why my number kept changing to 214-748-3647 every time I saved it to the DB).
[ Parent
| on HN ]
Re:Falsehoods Programmers Believe About Phone Numbers
by raw_creations on Saturday March 19, 2016 @11:24PM
(#11321643)
"Somewhere in Dallas, some poor bastard is wondering why his phone rings off the hook with calls for the Nevada Division of Mental Health & Developmental Services, the Jackson County Florida Chamber of Commerce, a yacht club in New York….."
And NASA, apparently
http://sbir.gsfc.nasa.gov/award_firm_list/selection_nid/3513...
Re:Falsehoods Programmers Believe About Phone Numbers
by mjevans on Sunday March 20, 2016 @04:01AM
(#11322204)
It should have strictly warned you about data truncation...
I'd honestly have rather it stored a NULL than that result though.
Re:Falsehoods Programmers Believe About Phone Numbers
by jloughry on Sunday March 20, 2016 @12:02PM
(#11323386)
Elsewhere I showed [1] that you can store that number in a 32-bit integer if you first swap the leading two digits.
Don't ever do this.
Re:Falsehoods Programmers Believe About Phone Numbers
by OJFord on Sunday March 20, 2016 @12:07AM
(#11321756)
I said 'some integer type' in anticipation of this comment if I'd just said int ;)
Although, the other reason that won't work (which I thought you were going to say) is that it'll end up as -X1XX!