Showing posts from 2024

C++23 explicit object parameters are really explicit

In programming languages with class methods, some take the instance of the class to operate on as an implicit parameter, often called this as a keyword. You don't see it in the list of parameters to the function, hence why it's referred to as implicit. Other programing languages make you explicitly name that parameter, often as the first parameter, and you may even be able to give it any name you want, since it is an explicit parameter for the object to operate on. C++ for most of its life has fallen mostly in the first camp by only offering implicit object parameters, though generic code can use std::invoke or std::invoke_r to not worry about the difference between free functions and member functions. As of the new C++23 language standard however, you can now use both implicit and explicit object parameters for class member functions without affecting the syntax used by callers in most cases. There is one case where it is a breaking change, and that's when you take the

A tale of two command arguments

A common issue I see in platform abstraction libraries is complete ignorance of fundamental incompatibilities between platforms. Let's look at an example case study: the arguments to the main function in C and C++. For starters, what text encoding do they use? Do you know off the top of your head? Better yet, where do they even come from? What is the purpose and source of the provided arguments? Do they come from a user? From the operating system? From a mix of the two? Do you really know what a locale is? Perhaps you think you know all these answers. There was once a time where I thought I did. Can you really be confident in your answers to these questions when you consider all platforms you hope to develop for? Consider this: on desktop operating systems, program arguments are often used for passing filesystem paths. The NTFS filesystem used by Windows stores file and directory names as arbitrary sequences of 16-bit numbers. Aside from a few banned numbers and sequences with sp

I broke my Windows DevKit 2023

I've been using my Windows DevKit 2023 a lot over the past years since it has good performance for software development and doesn't make my room hot like my traditional desktop PC. Inside it is a Microsoft SQ3 processor based on the Qualcomm Snapdragon 8cx Gen 3, making this a Windows on ARM device. It shipped with Windows 11, which was annoying until they finally added back the ability to get window titles on the taskbar, though it took them a long time to work out the bugs with that. Unfortunately, today's post is mainly about issues specific to this device, rather than to Windows 11 in general. I typically use the maximum supported number of displays: 3. Up to two displays can be 4k, but I only have one 4k display. I basically just re-use my existing 4 display setup for my x86 desktop which arranges the displays in a 2x2 grid (4k display is bottom right, primary display is bottom left, extra displays are above), using the extra monitor inputs and excluding the top right