[KLUG Programming] questions on picking data types

Bruce Smith bruce at armintl.com
Thu Jul 15 13:15:53 EDT 2004


> > > >> > If not, then it probably makes more sense to just store
> > > >> > the 9-digit SSN as an INT.  That way when you need to
> > > >> > retrieve a row ...
> > > Oh, I can't WAIT for them to add a digit! :)
> > 
> > Thats actually not so funny, they've talked about doing so in the
> > past.
> 
> I recall in the early 90s seeing a coding "tip" in Dr. Dobb's
> Journal that advised C programmers on a great way to store phone
> numbers.  Since all area codes have a 0 or 1 as their middle digit,
> you just swap the first two numbers and it will fit into an unsigned
> 32-bit int!  So (616) 555-1212 becomes 1665551212.  I pity any
> programmer who actually took this advice ten years ago (try this on
> Kalamazoo's new area code).

Ah yes, the good old days when the middle digit of the area code was
ALWAYS a one or a two, and the middle digit of the office code was
_NEVER_ a one or two.  That way old phone equipment could tell by the
first three digits dialed if the caller was using an area code or not.

Then we ran out of numbers, and along came the "North American numbering
plan", and got rid of that restriction to add more area/office codes.

I wonder what they'll the next time we run out of phone numbers? 
Add another digit or two?  That'll be fun, so plan for it now!  :-)

> Data storage should be unrelated to data formatting. 

Absolutely!

The one nice thing about these kind of changes is it's a good excuse to
purchase new hardware.  We got a new phone system about the time the
area code restrictions changed, and we bought a ton of new computers to
"handle" the Y2K "problem".  The bean counters wouldn't approve those
expenditures without a good "excuse".   :-)

 - BS




More information about the Programming mailing list