Disabling (and removing) code on release builds

Repo updated on 2017-03-13: added additional debug configurations to check different options to enable/disable minification, optimization and obfuscation. See the discussion in Optimize without obfuscate your debug build, including this comment.

Sometimes you have to add code to your applications that is used for debugging purposes. This can be very useful, and sometimes is keep there as it helps in the development and debugging of different parts of the application. But, some of this code can have unintended consequences:

  • it can reveal sensitive data to a potential attacker (internal URLs, session cookies, etc.)
  • it can have a performance impact in your application (excessive logging, performing operations not needed for release builds, etc.)
  • it can lower the security of your application (backdoor-like features to help while debugging, that can disable certain security features, or completely bypass them, etc.)

Continue reading Disabling (and removing) code on release builds

Four things you probably didn’t know about C++ (and C)

I’ve recently stumbled upon this interesting post of curious features of C++ I didn’t know of (being a C/C++ programmer for so many years!).

One of the techniques I find really amazing (even when sometimes this kind of cleverness comes to bite you in the ass afterwards!) is Duff’s device. I’ve done my fair share of loop unrollings and clever tricks on C, but I find this an step further!

Switching to Firefox again

The other day I stumbled upon the article Windows Timer Resolution: Megawatts Wasted and to make long story short, I ran powercfg -energy duration 5 on my system and found that Chrome, Spotify and Naver’s Line client for Windows were making my system to increase timer resolution to 1 ms, wasting energy and making my laptop run warmer than expected.

So I’ll be switching back to Firefox after quite a while using Chrome as my main browser, at least for regular browsing. Let’s hope Google fixes this soon.

Also, I’ve switched to Windows Store App version of Line client (my system runs Windows 8.1), and I’m considering what to do with Spotify.

UPDATE: maybe I’ve switched browsers too fast: now I’m seeing Firefox also increasing timer resolution to 1 ms! Possible causes:

  • Plugins (Flash, maybe?)
  • Google Mail
  • donno…

I’ll keep you posted.