Output refers to getting data from the program’s memory to the outside world, usually involving formatting and streams.

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

One can generally count on Stack Overflow for excellent, high-quality C++ advice. Several C++ experts regularly contribute (I see Howard Hinnant frequently, for example). But Stack Overflow won’t always give you good answers. Here’s a case where a request for a simple solution generates 10+ responses with code ranging from ~10-30 lines – and in one case over 60 lines spread over two files! – that use macros, templates, proxy objects, and in more than a few cases have surprising and likely annoying side effects… for something that could have been solved with a single character. Yes. One… single… character. Continue Reading