Ventures of an ex indie game developer

C++ parsing, Linux, and Linux no more

I recently "modernized" my C++ code style using a Python script. The script didn't catch everything and probably contained some bugs, but considering the amount of text it had to go through I'm pretty impressed with it anyway. C++ is notoriously hard to parse, and I just had to write the whole thing from scratch.

The script converted:
  • 1335 filenames+paths and 1040 include statements to lowercase;
  • 16 namespaces to lowercase;
  • 45 global variables from gMyVariable to g_my_variable;
  • 1550 constants from MY_COSTANT to kMyConstant;
  • 2556 member data variables from mMyVariable to my_variable_;
  • 6100 unique stack variable names from lMyVariable/pMyVariable to my_variable.
When the scoped stack variable and the parameter stack variable would collide, the scoped stack variable got an extra underscore, like so: _my_variable. Another 7k classes, functions and macros were left untouched as they already complied somewhat with Google's idea of a good coding style. Before-after:


So the code got a fix-up. Then I open sourced it on GitHub. And eventually I've gotten around to building the binaries for Linux (including the simulator for Trabant).

Wonderful! Finally I can leave the crappy world of Linux! The GUI is yuckie, but there's so much more to it than meets the eye at first. Here are some of my recent encounters:
  • Installing my Samsung laser printer took me hours, and the final solution included manually downloading and compiling some part of some CUPS driver (CUPS was originally an Apple network printing framework made open source).
  • Installing the scanner was fairly straight-forward, and worked quite well as long as I didn't perform too many configuration changes to the scanning software while the scanner was on.
  • When I booted, the computer would often hang with a blank screen due to a broken motherboard.
  • When I replaced the motherboard I got USB 3 support. Which rendered the USB scanner software non-working. Took me forever to realize what the problem was. Had to go into BIOS and disable USB 3.
  • The problem with the motherboard was not with the motherboard. Even with the new motherboard the system still hangs during boot 10-20% of the time. Probably some driver and/or some part of the kernel that hangs.
  • If computer hibernates, it hangs during boot 90-95% of the time. And takes forever those few times it actually does boot.
  • Had automatic updates enabled. Got a new kernel, 3.13.0-83. Hangs during boot 100% of the time. Same with 3.13.0-85.
  • When Ubuntu 16.04 LTS got released, the old 14.04 LTS became unfashionable and I was no longer able to update my system. I also don't dare to update to a newer Ubuntu as the most recent kernels crash on my machine.
  • Thus I was not able to install vlc to watch films.
  • Could never get my expensive Philips screen booting to 144 Hz. Instead I had to run something as extravagant as xrandr --output DP-4 --mode 1920x1080 --rate 144 every time I log in. When run the screen flickers for five seconds which lead to me not using that command at all, I just leave it running at the default 60 Hz. I could have just bought a 60 Hz screen for 1/3 of the price.
  • Whenever I jack in the HDMI cable to watch something on the TV instead the monitor flickers for five seconds and half of the time the TV becomes the primary monitor, so the thing corresponding to the "start menu" goes missing. Is the glass half-full or half-empty you ask. For Windows users' it's half-empty I can assure you. Also switching sound to go through the HDMI wire takes installing a software like pavucontrol and then clicking around for ten minutes until you succeed by accident. 
  • Default fonts, and font rendering in general look like shit. In the desktop and in the browser. I didn't think I had any preferences what so ever regarding fonts, but I apparently must have a distaste for ugly font rendering.
  • I used CodeLite for C++ programming and Sublime for Python hacking. CodeLite is free and has a lot of (MSVC-like) features, but is lacking some important ones like mouse hover over variable while in debug to read it's value, and keeping debug vars expanded during single-step which is really frustrating to be without. As always with large freeware, most of the interface is extremely poor and it's filled with output panes, quirky icons, incomprehensible check-boxes and empty areas with strange names. Which of these ugly icons and/or tabs would you click first? Dare to click one without mouse hovering first? I think not.
    It's not that I'm ungrateful or anything - or well I'm that too - but it's just that why would you want to work with this low quality when you easily can choose not to?
  • Sublime is like a poor version of Notepad++ and lacking hotkeys for "replace all" and similar features which Windows' users take for granted; the only option is to retort widd da mouse. I've used vim more than ever before in the last months, but the i-esc-:wq mode switching from the seventies sucks ass and if I ever use Linux seriously in the future I'll start using Emacs again. Vim you fucker.
So all in all, Desktop Linux made me buy a motherboard and a screen I didn't need, and I've wasted many hours building my own shitty software on other people's shitty software for no apparent reason since only 1.65% are stupid enough to run Linux on the desktop.

Where there any extenuating circumstances? Well when apt-get worked that was nice. And at first I was a bit infatuated with the "configure everything" concept. But frankly, that was it. As soon as I have time I'll move over to Windows 10 and never look back.

About the author

Mitt foto
Gothenburg, Sweden