The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,861 other subscribers

Crowbarring Windows 95 into Windows NT with CAPITALS • The Register

Posted by jpluimers on 2026/02/04

Via [Wayback/Archive] Crowbarring Windows 95 into Windows NT with CAPITALS • The Register refers a nice trick that I have used in various case-codebases as well.

On case sensitive environments the casing method is easy no matter if you use macros or just regular identifiers.

On case insensitive environments, prepending or appending soemthing like an underscore (_) works just as well.

The trick referred to is in a section of [Wayback/Archive] How did the Windows 95 user interface code get brought to the Windows NT code base? – The Old New Thing:

Protecting the changes was done in a variety of ways.

One was to enclose all the new code inside #ifdef WINNT directives so that they weren’t compiled by Windows 95, or #ifdef#else#endif blocks if the Windows NT version had to diverge from the Windows 95 version. Another was to use macros and typedefs like TCHAR and LPCTSTR so that the same code could compile both as Windows 95 and Windows NT, but using different base characters.

In the case of sizeof directives, a change from sizeof(stringBuffer) to sizeof(stringBuffer) / sizeof(stringBuffer[0]) has no effect on Windows 95 because the sizeof(stringBuffer[0]) is 1, and dividing by 1 has no effect, so that change could be left without protection. But the Windows NT team had another problem: How would they know whether a particular sizeof was one that had already been vetted for Windows NT compatibility, as opposed to one that came from fresh code changes to Windows 95 that need to be inspected? Their solution was to define a synonym macro

#define SIZEOF sizeof

When the Windows NT team verified that a sizeof was correct, or when they fixed it to be correct, they changed the sizeof to SIZEOF. That way, they could search the code for lowercase sizeof to see what still had yet to be inspected. (The Windows 95 team were told to continue using sizeof in new code, so as not to mess up this convention.)

--jeroen

One Response to “Crowbarring Windows 95 into Windows NT with CAPITALS • The Register”

  1. Attila Kovacs's avatar

    Attila Kovacs said

    Hey Jeroen, I just wanted to say hi! I was happy to see there are new posts!

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.