Zeroing Memory is Hard (VC++ 2015 arrays)

Quick, what’s the difference between these two C/C++ definitions of initialized local variables?

char buffer[32] = { 0 };
char buffer[32] = {};

One difference is that the first is legal in C and C++, whereas the second is only legal in C++.

Okay, so let’s focus our attention on C++. What do these two definitions mean?

Continue reading

Posted in Performance, Programming, Visual Studio | Tagged , , | 18 Comments

DNA-Free Dining Made Easy

Recent studies have confirmed that more than 80% of Americans support labeling of foods containing DNA.

And why not? DNA is genetic material. DNA is used for reproduction, so eating another animal’s DNA is uncomfortably close to bestiality.

Plant DNA isn’t much better. After all, who wants to risk having a corn stalk sprouting from your arm?

And if you want more proof of the dark dangers of genetic material then look no further than the Zika virus – this microcephalitic plague demon is almost 100% RNA which is DNA’s faithful messenger boy.

Continue reading

Posted in Uncategorized | Tagged , , , | 13 Comments

UIforETW is No Longer a CPU Hog

A few months ago I wrote about how many processes on my system were waking up and wasting CPU time for no good reason, thus wasting battery power, electricity, and CPU power. I was surprised that nobody called me out on the hypocrisy of my complaints because UIforETW, my open-source ETW trace recording and management tool, was not well behaved when idle.

This has now been fixed.

Continue reading

Posted in Performance, uiforetw, xperf | Tagged , | 6 Comments

Compiler Bugs Found When Porting Chromium to VC++ 2015

WinDirStat of Chromium, no generated codeMoving a big software project to a new compiler can be a lot of work, and few projects are bigger than Chromium. In addition to the main Chromium repository, which includes all of Blink, there are over a hundred other open-source projects which Chromium incorporates by reference, totaling more than 48,000 C/C++ files and 40,000 header files. Porting Chromium on Windows to VC++ 2015 requires getting all of these projects to build and run.

As of March 11th 2016 Chromium for Windows has switched from VC++ 2013 to VC++ 2015, and it doesn’t look like it’s switching back. This will give us more C++ 11 features, new security options, much faster LTCG/PGO builds, and other advantages.

The tracking bug for this project currently has over 330 comments on it, with contributions from dozens of developers. Writing about all of those changes would require an entire book. So I’m going to focus on my favorite part of this project – compiler bugs. In particular, bugs where the compiler silently generates incorrect code.

Continue reading

Posted in Programming, Visual Studio | Tagged , , , | 33 Comments

A modest proposal for a more natural KB

imageI recently wrote a blog post saying that I thought Windows Explorer should use the more natural base-10 meanings of the kB/MB/GB/TB prefixes, instead of the base-2 meanings that are a few percent larger.

I convinced nobody. I was told, repeatedly, that there was nothing ‘natural’ about a base-10 TB and that base-10 prefixes in computing were just a way for hard-drive manufacturers to rip-off innocent customers.

Okay, I get it. What the people really want are kB/MB/GB/TB prefixes that are bigger than those puny base-10 prefixes, and that are genuinely natural. America didn’t become great again by using foreign prefixes that are smaller than they should be. Therefore I present to you:

The KeB.

Continue reading

Posted in Fun, Rants | Tagged , , , , , , , , , , , , , | 10 Comments

Power Wastage On An Idle Laptop

Ever since I upgraded to Windows 10 it’s felt like my battery life is worse. My suspicion was various scanning tasks that were springing to life more frequently, but it was just a hunch.

So, I did what I do – I profiled. I recorded long-running ETW traces to see how much CPU time was going to the processes that I have chosen to run, and how much was going to processes that Microsoft has chosen to run.

I should have done this years ago…

Continue reading

Posted in Investigative Reporting, Performance, Programming, uiforetw, xperf | Tagged , | 32 Comments

Cars in Canada Get Better Mileage than in the US

Cars in Canada really do get more miles to the gallon. Well, “did”, technically, since Canada now uses liters/100 km for fuel efficiency. The reason why has nothing to do with climate or driving habits and has everything to do with the amusing flaws of the measurement systems that preceded metric.

Continue reading

Posted in Fun | Tagged | 10 Comments