C

If you need a compiler and build system, my post on [make]({% post_url 2016-10-09-make %}) and GCC could be handy. Philosophy Rob Pike’s 5 Rules of Programming Source You can’t tell where a program is going to spend its time. Bottlenecks occur in surprising places, so don’t try to second guess and put in a speed hack until you’ve proven that’s where the bottleneck is. Measure. Don’t tune for speed until you’ve measured, and even then don’t unless one part of the code overwhelms the rest.
Read more →

Cherished GCC flags

A (work in progress) compilation of useful GCC configuration, focused on C. -W warnings. -Wall is a must. -Werror to treat warnings as errors. -l instructs the linker it has some work to do (i.e. link a library please). -lm is shorthand for -libm and in turn -libm.a is a static library is selected. -L hint to the linker where to locate libraries. -L/opt/gdbm-1.10/src in combination with -lgdbm tells the linker exactly where to find the gdbm libraries.
Read more →