March 19th, 2004

Why does the Resource Compiler complain about strings longer than 255 characters?

As we learned in a previous entry, string resources group strings into bundles of 16, each Unicode string in the bundle prefixed by a 16-bit length. Why does the Resource Compiler complain about strings longer than 255 characters? This is another leftover from 16-bit Windows. Back in the Win16 days, string resources were also grouped into bundles of 16, but the strings were in ANSI, not Unicode, and the prefix was only an 8-bit value. And 255 is the largest length you can encode in an 8-bit value. If your 32-bit DLL contains strings longer than 255 characters, then 16-bit programs would be unable to read those strings. This is largely irrelevant nowadays, but the warning remained in the Resource Compiler for quite some time. It appears to be gone now. Good riddance.

Topics
History

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.