Journal

C++: Sane Shift Operators

Bitwise shift operators in C++ are wrought with perils. Undefined behaviour awaits those shifting negative integers or shifting too far, shifting by a negative number is implementation defined, which means the compiler cannot just pretend it didn’t happen or format your hard drive, but you still don’t have any guarantees about what exactly you get.

Read More …

bsda:obj: Object Oriented Programming Dos and Don'ts

Once upon a time I wrote an OOP framework for shell scripts and in 2010 I even presented it at EuroBSDCon. Originally I was going to use bsda:obj, the OOP shell scripting framework, to rewrite the bsdadminscripts. By now they have been rotting, mostly long obsolete and abandoned, on sourceforge. However a couple of the tools therein remain popular, which finally got me to recode and release them. Post-release I’ve started cleaning up bsda:obj so I would like to share a couple of lessons I’ve learned and applied over the years.

Read More …