Tippets

This category is for posts about small tips and interesting code snippets – or “tippets”.

A while ago a guy I know was working on a program that involved a large number of “jobs” read from a file/database. The issue he had was that he wanted different “views” of those jobs – for example, he wanted a view of the jobs sorted by job ID, another of the jobs sorted by start/end time, another sorted by priority, and so on. Continue Reading

When you’re working with bytes as numeric values – rather than characters – there’s a gotcha that can burn you when you try to stream those values out using standard library streams. The insertion operator for all character types – char, signed char, and unsigned char – prints the character value, not the numeric value. Lots of beginners struggle with this and even many experts don’t know the easy fix. Continue Reading

A problem I come across rather frequently has to do with the fact that input in C++ requires a pre-existing variable of the correct type, which either has to be uninitialized or initialized to some “safe” value. There’s a third option, though, and it’s the topic of my first Tippet. Continue Reading

One of the things I hope to do from time to time on this blog is to offer short bits of code that solve relatively common programming problems, and that illustrate clever ways to use modern C++. These are combination tips and snippets, so I’ll be calling them “Tippets“.

You can submit Tippets, and if I like them, they will (eventually) be posted on the blog. You will be properly credited, of course.