Entries tagged “#rant”

Sat 02 March 2019

Is it worth using make?

You may think you've created a nice and tidy Makefile, which tracks dependencies and works across many different operating systems, but ask yourself these questions (and answer honestly): Which compiler does your Makefile support? Is it GCC? Or Clang? Some of their options are pretty similar, so it may not … read more
Thu 07 February 2019

C++: Shooting yourself in the foot #4

C++11 has introduced a better way to generate random numbers than the immortal srand(time(NULL)) and rand() % N method. However, this family of functions sometimes may behave in a not very intuitive way, especially when it comes to multi-platform programming. TL;DR: before commenting, please at least read … read more
Tue 21 August 2018

My system's time was so wrong, that even ntpd didn't work

Hi, Time management is always hard. I mean, it's hard for ordinary people -- the internets are full of ebooks and tips on how to organize your time, and there are lots of books about the problem. It's also hard for programmers -- you need to take into account different timezones, those … read more
Thu 01 March 2018

C++: Shooting yourself in the foot #3

Hi, Everyone says that programming is complicated. Is it? Well, actually it is, especially if you're using your programming language in a non-recommended way. Take file input/output for example. In C++ there are some ways you can perform file I/O: std::ifstream is one example. Multiple frameworks like … read more
Sun 11 February 2018

C++: Shooting yourself in the foot #2

Hi, There are people in this world who are forced to use C++ against their will. Those people often defend themselves by writing C code, and by compiling it with a C++ compiler. Then hope that noone will notice. There are a lot of problems with this, and this short … read more
Sun 11 February 2018

You're using TABs in a wrong way

Hi, Tabs or spaces? I'm sure you have a strong opinion on this subject, as probably everyone. Can we summarize the arguments for each side? Advantages of TABs: Using TABs means the source code uses less space. Each 4 bytes (2 bytes if you're a Ruby programmer, or sometimes 8 … read more
Sat 20 January 2018

C++: Shooting yourself in the foot #1

Hi, Recently I was browsing some code, and I saw some construct that maybe is not very obvious to everyone. The code was located inside an important function, which took a hash in the argument and performed some action based on the contents of this hash. Pseudocode: typedef process_t { // ... uint8_t … read more