Fog Creek Software
Discussion Board

Username field length

Why do we have username field length mostly as 40 char? I have not seen such a long user name. I have seen at the max 25 char long.

Friday, September 26, 2003

"I can't believe we only left 40 characters for e-mail address. It needs to be 80 at least."

That's the job I worked a few jobs ago.

Brad Wilson (
Friday, September 26, 2003

40 chars for an email address is too short:

As for username, it depends on who controls the field. If you control it, and you're thinking standard usernames, then yeah, generally 15 is plenty. If you *don't* control it, then you have to be prepared for "use email address as username" in which case see above. :-)


Friday, September 26, 2003

There is also the group that believes in using the full name as a username, i.e. "Andrew Hurst" for 12 chars or "Thurston Howell III" for 20.  I think 20-30 is enough for most uses. (except email, noted above).

Andrew Hurst
Friday, September 26, 2003

Why would you (the programmer) set a short limit anyway?  What's the point?

No RDBMS worth the name cares or differs in performance or takes more storage if you set the limit to, say 200 chars.

So why set an arbitrarily short limit? Just seems like peculiar behaviour.

Friday, September 26, 2003

Actually, I take it back. It was 80, and we made it 160. The affecting factor was the temporary e-mail addresses that generated.

Brad Wilson (
Friday, September 26, 2003

Think about it in the broader context of uses for this information.

Do you want to use it for mail-outs? If you intend to print labels, better keep it less than 35 characters.

Do you have to interface to another system? What are that system's semantics for names, addresses and related information?

Do you work in an industry which standardises information for exchange between companies, such as banking? If so, make sure you don't exceed the (sometimes de-facto) standard.

On this issue, I saw a banking system have to DOUBLE all the name and address field sizes when it moved from Australia to India. Some of those people have REALLY long names. Same in Thailand, made worse by the need for double-byte character support.

Friday, September 26, 2003

> Brad Wilson (

43 characters

Mark T A W .com
Friday, September 26, 2003

You would think that there's a limit to the allowable length of an email address, and I believe there was a 256 char limit under one of the obsoleted RFC's (822 superseded by 2822?), but the superseding RFC seems to not have a limit.  Can anybody say for sure one way or the other?

Also, this is only marginally related, but is it true that a windows path doesn't always fit in TCHAR[MAX_PATH] ?  Something about paths beginning with "\\?\", or something?

It's OT, but I'm curious.

Friday, September 26, 2003

Also, this is only marginally related, but is it true that a windows path doesn't always fit in TCHAR[MAX_PATH] ?  Something about paths beginning with "\\?\", or something?

Yes, this is true.  At least under NTFS, the limit is much greater than MAX_PATH.  I think MAX_PATH is around 256 characters but the real limit is more like 32k.  I've had problems with this in the past due to nested folders on the desktop or in Favorites.  When this happens, it's easy to see what apps rely on hardcoded path sizes and which have robust path handling. 

I could've sworn that in the past that Windows allowed you to freely use the full path limit.  However, I just tried out some test cases that used to work but they give errors now when MAX_PATH is exceeded.  I'm running XP with all the latest updates so I'm going to go out on a limb and guess that Microsoft has started enforcing MAX_PATH at the API level for security. 

You can still create and access paths exceeding MAX_PATH by using file shares or drive mapping. 

Saturday, September 27, 2003

*  Recent Topics

*  Fog Creek Home