Z Space Blog

your source for Game Z

Posts tagged Programming. Subscribe?

Page 1 of 1

Why I learned C "Category-0" Style

I've been asked a few times over the years why I chose to learn C with the colloquially-known "K&R C Bible", and specifically the Category-0 style, coined on USENET back in the day.

For those unfamiliar, I'm talking about The C Programming Language, 2nd Ed., by Brian Kernighan and Dennis Ritchie, the creators of the language. In it are a series of exercises that the reader can work on to build their knowledge of C through actually building something with it. On comp.lang.c, people would share their solutions to exercises in this book. After a while, they coined different categories of solutions, to refer to their robustness and complexity.

Category-0 is solving each exercise using only the knowledge the book gives you, up to that point. In other words, it's to approach it as a complete newbie and see what you can put together using only the stuff you've learned in the book.

Read more...

Easy diffing with Vim

Vim has good support for showing the differences between two (or three) files with either the vimdiff command or setting up a diff session manually. This often requires opening the files in their own window panes, then using :diffthis in all the relevant files. If you're in the middle of an editing session, stopping to set up this diff session can cause you to lose focus. I wrote a function in my vimrc that automates this process, so the user can focus on making decisions instead of building their UI or some other flow-breaking process.

Read more...

Page 1 of 1