Evan Teran's Blog

Moving printf into the modern age using C++17

Ever since c++11 introduce variadic templates, I started seeing people implement some "safe printf" examples. They are pretty cool, but none of them attempted to actually implement the printf fully with all of its quirks. Instead, they all pretty much do the same thing:

  1. Use variadic templates to verify the sanity of the parameters
  2. Delegate the actual formatting to the libc printf

I think we can do better...

Read More...

Well This Is Embarrassing (I Got Hacked)

I suppose it happens to everyone eventually. My blog got hacked. :-/

Read More...

Portable BitFields Using C++11

There are lots of reasons to using C++'s bit field feature. Perhaps you need a more compact way to represent your data structures, maybe you need to use them interact with hardware, or if you're writing an emulator, maybe you want to use them to efficiently represent the hardware that you're emulating. The list goes on...

Read More...

A bit about fixed sized dialogs in Qt

Most of the time, it makes the most sense for our dialogs to be designed with layouts such that it looks good with just about any width or height. But there are a few cases where locking in the size makes sense. The most classic example I can think of is an "about this application" dialog box.

Read More...

Qt’s style system FTW (Adding Theme Support to a Qt Application)

A few years ago, I was asked to add "theme" to a Qt project of mine. I wasn't fully aware of the power of Qt's style system, so I did it the hard way. I created a configuration file which contained the theme-able attributes of just about everything I could think of. And when the application started, I parsed it, and applied the colors, fonts, etc. After a short bit, I noticed things I had overlooked and added them. It wasn't amazingly hard, but it sure could have been easier. Today I'd like to discuss the easy way :-).

Read More...