Monday, November 5, 2012


I've decided to start composing and maintaining this blog using Markdown.

If you're not familiar with it (or even if you are), Markdown is a text-to-HTML conversion tool for web writers. Raw Markdown is much more readable and easier to work with than raw HTML. It doesn't directly provide the full power of HTML, though you can include raw HTML in a Markdown document -- and you can do italics, bold, and bold italics directly in Markdown.

It's used (in slightly different flavors) on GitHub and on the StackExchange network of sites, among other places.

All posts on this blog are maintained as a GitHub project. If you're sufficiently curious, you can see the Markdown form of all the articles, and how I've revised them over time.

One thing I've noticed with the composition software used by is that switching between the "HTML" and "Compose" views changes the HTML; in particular, it removes <p> paragraph markup, replacing it by <br /> line breaks. Because of this I need to copy the Markdown-generated HTML into the HTML window and click the Update button without looking at the preview. Annoying, but not fatal.

Markdown is converted to HTML by the markdown command, which is also available as a .deb package on Debian and Debian-derived systems such as Ubuntu and Linux Mint:

sudo apt-get install markdown

It should be available for other systems as well. I run a simple gen-html script (included in the GitHub project for this blog), and then manually copy-and-paste the generated HTML into's web interface. The manual step is annoying, but overall it should make it easier to write and maintain this blog.

Pandoc is another good conversion tool, handles numerous other formats as well. It should be available for most systems.

Who knows, I might even get around to posting more articles!

Last updated Sat 2013-12-28 16:29:29 PST

Monday, March 5, 2012

No, strncpy() is not a "safer" strcpy()

The C standard library declares a number of string functions in the standard header <string.h>.

By the standards of some other languages, C's string handling is fairly primitive. Strings are simply arrays of characters terminated by a null character '\0', and are manipulated via char* pointers. C has no string type. Instead, a "string" is a data layout, not a data type. Quoting the ISO C standard:

A string is a contiguous sequence of characters terminated by and including the first null character.

Friday, January 13, 2012

First post

Greetings to my vast army of followers.

This is my new blog, in which I will sporadically post rants and musings on software development, programming language standards, and whatever else strikes my fancy at the moment.


Last updated Mon 2012-11-05 16:48:00 PST