January 29, 2018

A C++ Hello World And The Rose Gold Walled Garden Of Doom

This is Part 3 on my series about cross-compilation. You can check out part 1 1 and part 2 2 first ! linuxnewbieguide.org You cannot caters to the needs of Windows and Linux users while ignoring the third major, well, second actually, desktop operating system. The Operating System I’m talking about is of course developed and commercialized by a company best known as the one who gave Clang to the world, is mostly responsible for maintaining WebKit (after most of the industry moved to Chromium), and created some other amazing open sources softwares such as CUPS. Read more

January 24, 2018

A C++ Hello World And the Cute Heartless Rainbow

This is Part two of a series wherein we build a “Hello World” application. If you are late to the party, I encourage you to check part 1 first. Hic Sunt Arcūs So, our Boss came in to check on our progress. They were starting to wonder why it takes a whole day to port a 3 lines application to a new system. But the real reason of their visit was to ask for a new feature. Read more

January 22, 2018

A C++ Hello World And A Glass Of Wine, Oh My !

#include <iostream> int main() { std::cout << "Hello, World\n"; } Nothing to remove, nothing to add. This is the proper “Hello World” in C++. All the others Hello World are wrong. But this is not where I rant about how using namespace std; crystallizes everything messed up with the teaching of C++. Another time perhaps. Today we are gonna be compiling that hello world so that it can be executed on a target system. Read more

January 20, 2018

An Ode To Code Formatting Tools

Your modifications fix the calculation But I’m afraid you forgot a tabulation. This is the beginning of your tribulation. Your perfect correction won’t bring you elation. If there was a way to just automate, Maybe you could avoid arguing with your mate. Should there be a space after the bracket How many white spaces, How many line breaks Did you know tools could format your troubles away? You have to choose, there is no midway Read more

January 10, 2018

Undefining the C++ Pre-processor

There are only two kinds of languages: the ones people complain about and the ones nobody uses — Bjarne Stroustrup I like that quote. it explains both JavaScript and Haskell. And by that measure the preprocessor is a great language in that people use it, a lot. It’s never considered separately from C and C++, but if it was, it would be the number one language on TIOBE. The preprocessor is both extremely useful, and pervasive. Read more

October 31, 2016

Stranded with a C++ compiler and a bunch of queues

A friend had a phone interview for a job in a company that I won’t name It’s Microsoft. One of the questions was about describing how he would write a stack, only using standard queues. I was confounded, because long before an algorithm could form in my mind, I already decided that there was no solution that would actually be useful in any real life scenario. template <typename T, typename Container = std::queue<T>> class stack { public: void push(const T &); void pop(); T& top(); std::size_t size() const; bool empty() const; private: void transfer(); Container a, b; }; template <typename T, typename Container> void stack<T, Container>::push(const T& t) { a. Read more