Safe Bitfields in C++
Related
More from Preshing on Programming
C is a simple language. You’re only allowed to have one function with each name. C++, on the other hand, gives you much more flexibility: You can have multiple functions with the same name (overloading). You can overload built-in operators like + and ==. You can write function templates. Namespaces help you avoid naming conflicts. I like...
Flap Hero is a small game written entirely in C++ without using an existing game engine. All of its source code is available on GitHub. I think it can serve as an interesting resource for novice and intermediate game developers to study. In this post, I’ll explain how Flap Hero’s code is organized, how it differs from larger game projects, why it...
I just released a mobile game called Flap Hero. It’s a Flappy Bird clone with cartoony graphics and a couple of twists: You can go in the pipes (wow!) and it takes two collisions to end the game. Flap Hero is free, quick to download (between 3 - 5 MB) and opens instantly. Give it a try! Flap Hero is open source, too. Its source code is...
Consider the lowly text file. This text file can take on a surprising number of different formats. The text could be encoded as ASCII, UTF-8, UTF-16 (little or big-endian), Windows-1252, Shift JIS, or any of dozens of other encodings. The file may or may not begin with a byte order mark (BOM). Lines of text could be terminated with a linefeed...
Plywood is an open-source C++ framework I released a few weeks ago. It includes, among other things, a runtime module that exposes a cross-platform API for I/O, memory, threads, process management and more. This post is about the I/O part. For those who don’t know, I/O stands for input/output, and refers to the part of a computer system that...