Hacker Newsnew | past | comments | ask | show | jobs | submit | ack_complete's commentslogin

The most offensive part of the Sinofsky response is this part:

> WinRT (2012) - it (or the embodiment in Windows 8) failed in the market but it also showed both the problem and potential solution to building for new markets while respecting the past

I can't express how wrong this is. WinRT was the most destructive thing that the Windows team ever did to the OS. It drove a hard stake into Windows, splitting it in half and declaring that anything previous to Windows 8, oriented toward desktop, or using primary input through mouse and keyboard over touch was dead. Microsoft basically told all existing Windows developers that if they weren't building a new, touch-oriented, mobile-style app specifically for Windows 8, they didn't matter and wouldn't get any support whatsoever, which is exactly what happened every time they broke existing desktop functionality. Calling this "respecting the past" is a crass insult and taking no responsibility for damaging the Windows development experience and accelerating development away from native Windows apps.


The place I work at tried using an SO enterprise instance and it was quite ineffective. We didn't have the toxicity of the public instance, but generally having a Q&A forum double as a knowledge base is an oddball format that doesn't work out. Adding AI integration is not likely to compensate for that.

The Windows API uses WCHAR = wchar_t, so if you use char16_t, you have to convert back and forth to avoid running afoul of strict aliasing rules. This imposes conversion costs without benefits; both using wchar_t directly or converting to/from UTF-8 are better.

Or, set up the manifest in your app[1], and just use UTF-8 and `std::string`/`std::string_view` everywhere.

[1]: https://learn.microsoft.com/en-gb/windows/apps/design/global...


Doesn't need to be inline assembly, just pre-encoded lookup tables and intrinsics-based vectorized CRC alone will add quite a lot of code. Most multi-platform CRC algorithms tend to have at least a few paths for byte/word/dword at a time, hardware CRC, and hardware GF(2) multiply. It's not really extreme optimization, just better algorithms to match better hardware capabilities.

The Huffman decoding implementation is also bigger in production implementations for both speed and error checking. Two Huffman trees need to be exactly complete except in the special case of a single code, and in most cases they are flattened to two-level tables for speed (though the latest desktop CPUs have enough L1 cache to use single-level).

Finally, the LZ copy typically has special cases added for using wider than byte copies for non-overlapping, non-wrapping runs. This is a significant decoding speed optimization.


One difference is that the Mac OS itself was not initially 32-bit clean, with the top byte being used by the Memory Manager.


The main thing that's hard going down this route is dark mode support. The Win32 USER and common controls just don't not support dark mode, but are actively hostile to it due to the amount of hardcoded light colors and backgrounds in the system. All of the system colors are light regardless of the dark/light system setting, highlights are hardcoded to light blue, disabled controls use a hardcoded color, half of the window messages for changing control colors are silently ignored with theming is enabled. Menus are among the more difficult to deal with as they require extensive owner draw.

On top of this, there are a small handful of system UIs that do support dark mode and make your program look inconsistent with dark mode regardless. Message boxes will switch to dark mode, and so will file dialogs -- which is a problem if you've used the Vista-style customization, as any syslinks will appear in a color of blue that's hard to read against the dark mode background.


First, dark mode is for people who set their screen brightness too high.

Second, win32 is designed with the ability to change all the default colors and you used to be able to do this by right clicking the desktop and selecting "properties". If dark mode doesn't follow this - just another symptom of Microsoft's siloing incompetence. The team that wrote dark mode may not have been aware that this feature existed because parts of the platform are so disconnected from other parts.


Dark mode for apps is a setting in the OS and a general expectation now, it's suboptimal to ship a new UI that doesn't support it. And, again, Win32 message boxes in your program will switch to dark mode whether you want them to or not.

Win32 controls ignoring system colors goes much farther back than dark mode being introduced in Windows 10. The theming engine that broke a lot of that functionality was introduced in Windows XP. Beyond that, there were always a few hardcoded colors like disabled gray text going back to Windows 95.

Dark mode ignoring Win32 system colors is not incompetence. It was _intentional_. Dark mode was introduced by the UWP side, which intentionally did not extend it to Win32. To this day, there is not even a Win32 API for desktop apps to query whether dark mode is even enabled. The official recommendation is to compute the luminance of the UWP foreground color setting:

https://learn.microsoft.com/en-us/windows/apps/desktop/moder...


But they had dark themes for the XP theming engine, e.g. the Zune theme, didn't they? They could make the dark mode switch to a dark theme for XP-style themed controls and configure dark colors for the Win32 system colors.


Yes, and this is also how Windows 10/11 explorer turns some parts of its UI dark like scrollbars. But notably, Microsoft refuses to officially support Explorer's dark control themes or ship a complete dark theme, and because the theming engine only loads themes signed by Microsoft, no one else can ship one either without patching the OS.

Only a very small minority of users actually care about dark mode. It is not a general expectation for software, as loud as those users may be on forums like this one.


And how do you know this? I decided to check myself, looked for dark mode statistics on android, and:

>Dark mode is used by 81.9% of 2,500 Android users on their phones, in apps, and in other situations. 9.9% alternate between the light and dark

So it's the other way around. Only a very small minority of users actually care about light mode.


Mobile is different from desktop. Dark mode became popular with OLED panels because on those it saves battery, and blacks actually look nice, compared to the average LCD. I use dark mode on mobile but light mode on desktop.

I think android is a big difference here. What about excel or Google sheets? Word?

If you're building win32 you're not targeting android.


That survey was power users only: https://www.androidauthority.com/dark-mode-poll-results-1090...

I would be astounded if a majority of general Android users used dark mode, as light mode is the default on most phones (all, IME).


Mine switches between light and dark depending on the time of day. It was the default behavior.

I'm not sure how much Android use generalizes - I prefer light mode, but I'll use dark mode for the battery savings on portable devices with OLED screens.


On Apple platforms is very uncommon to find apps that only support light mode. The only one on my phone is the app for my old Chinese robot vacuum.


Dark mode ignoring Win32 system colors is not incompetence. It was _intentional_.

Intentional malice, in other words. A stupid attempt at pushing UWP.


> First, dark mode is for people who set their screen brightness too high.

Not at all. It became popular mainly because as part of the spread of the flat UI epidemic, the previously non-optional “light mode” OS UI themes all shifted away from midtone colors to blinding stark whites. This meant that monitor brightness settings that had previously been comfortable suddenly weren’t.

On top of this, modern flat UI light mode themes consistently have poorer contrast and delineation than their dark mode counterparts, because higher contrast with darker grays makes flat white UI themes appear “dirty”. So even if the brightness isn’t an issue, your eyes have fewer visual cues to guide them.

Aside from that, on IPS panel monitors lowering brightness past a certain point also greatly lowers color vividness which looks bad, which is why some of us like to keep it maybe not maxed but a bit higher than is comfortable with light mode.


It is not. I have some issues with my eyesight and dark mode makes it easier to use a computer in some lighting conditions. So for me dark mode is an accessibility feature. And yes you could use the ugly recolor feature windows has but dark mode does the same thing and looks better most of the time cause a UI designer actually looked at it.


> dark mode is for people who set their screen brightness too high

There can be other valid perspectives than your own.

I don't think your brightness sentiment is universally shared by most people, hence the downvotes. I think this comes from one particular study that people just end up parroting, possibly via third-hand gossip.

While a sufficiently low-brightness screen might have some specific advantages to dark mode, I think the issue is more nuanced than that.

First, not everyone can set their brightness to an appropriate level.

If the user is prone to migraines or light sensitivity, light mode even at a low setting could trigger headaches.

Light mode also produces significantly more blue light, which can have health side-effects as well.

If you keep a white screen on at appropriately low brightness in a dark room, the relative difference between the screen and the surroundings is still massive. This creates pupil strain as the eye constantly adjusts. Dark mode aligns the screen's luminance closer to the room's, reducing this strain.

Dark backgrounds make colors pop more vibrantly and prevent the "washed-out" look that can happen when bright images sit on a white background. It can also reduce halos visible around bright objects in photography apps and make the UI less distracting.

For battery-powered/mobile devices, dark mode uses much less battery power on OLED screens.


Or, unless they've changed it, hardware accelerated rendering. Winforms was based on System.Drawing, which used GDI+, which was largely software rendering. This was confusing because GDI+ was not really related to GDI, which had and still does retain some hardware acceleration support. Even basic color fills start becoming an issue with a big window/monitor.

Winforms is also .NET based, so it's inaccessible if you don't want to write your UI in and take a dependency on .NET.


DevExpress has many advanced Winforms controls that are all GPU accelerated and super fast. So Winforms can certainly do GPU acceleration.

It's hard to describe how uselessly restrictive the UWP model was when they originally introduced it as "Metro-style apps" in Windows 8. Among the things it officially did not support included:

- Multiple monitors - Non-full screen views - Sideloading outside of the Store - Offline installation - Explicit threads - thread pool only - Aligned memory allocation - malloc only - Any C++ compiler other than MSVC - Support for any version of Windows other than Windows 8 - Running apps as administrator - Running more than one instance of an app at a time - Runtime shader compilation

If any ONE of these things was a blocker, you could not write a Metro style app. And yet Microsoft pushed this extremely hard -- including almost completely ending any maintenance of Win32 APIs. And despite the many relaxations and extensions, UWP is still largely useless today, and now even itself seems to be going into maintenance mode. All of which has done a lot of damage to the state of Windows desktop platform development.

As an example of how bizarre UWP is, for some reason every time they published a list of new APIs added to it, they converted the list of API identifiers to lowercase in the documentation:

https://learn.microsoft.com/en-us/windows/uwp/whats-new/wind...

It's relatively insignificant, but... why? Just one of many things that showed how immature UWP was.


Even that is not necessarily needed, I have gotten major speedups from LUTs even as large as 1MB because the lookup distribution was not uniform. Modern CPUs have high cache associativity and faster transfers between L1 and L2.

L1D caches have also gotten bigger -- as big as 128KB. A Deflate/zlib implementation, for instance, can use a brute force full 32K entry LUT for the 15-bit Huffman decoding on some chips, no longer needing the fast small table.


There are also mode switching and calling convention issues.

The way that the vector registers were extended to 256-bit causes problems when legacy 128-bit and 256-bit ops are mixed. Doing so puts the CPU into a mode where all legacy 128-bit ops are forced to blend the high half, which can reduce throughput of existing SSE2-based library routines to as low as 1/4 throughput. For this reason, AVX code has to aggressively use the VZEROUPPER instruction to ensure that the CPU is not left in AVX 256-bit vector mode before possibly returning to any library or external code that uses SSE2. VZEROUPPER sets a flag to zero the high half of all 256-bit registers, so it's cheap on modern x86 CPUs but can be expensive to emulate without hardware support.

The other problem is that only the low 128 bits of vector registers are preserved across function calls due to the Windows x64 calling convention and the VZEROUPPER issue. This means that practically any call to external code forces the compiler to spill all AVX vectors to memory. Ideally 256-bit vector usage is concentrated in leaf routines so this isn't an issue, but where used in non-leaf routines, it can result in a lot of memory traffic.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: