News for hackers. Stuff that matters.
Re:Ask HN: Improve C language skills after K&R? by pjungwir on Friday July 29, 2016 @03:58PM (#12189505)
I agree with the recommendation here to read Expert C Programming: Deep C Secrets by Peter Van der Linden.

As for practice: the challenge in learning new tech is always to find a small-scale project that motivates you to build something. As a mostly-Rails developer like you I've found a couple opportunities to write C by building Postgres extensions. Here are my two:

https://github.com/pjungwir/aggs_for_arrays/

https://github.com/pjungwir/inetrange

Both of those are used in production systems and had good justification for dropping down to C.

Or here is a tiny patch to the Postgres btree_gist extension that I am hoping to get merged:

https://commitfest.postgresql.org/10/332/

The JSON support in Postgres is still pretty new. Maybe you could write some worthwhile additions for dealing with json or jsonb data? I would just look at underscore.js for inspiration.

Also if you have a collection of personal shell utilities, you could try rewriting them in C. Here is one of mine:

https://github.com/pjungwir/range

It is for printing a range of numbers like `1, 2, 3`. It is surprising how many features you can add to a tool like that! (It is a bit of a joke, and I have since learned bash gives you `{1..10}`. But something similar could still make a good learning project.)

Perhaps you could also write a ruby gem that wraps some C library. For instance I'm fond of the jsmn JSON parser [1]. Maybe a gem built around that could give performance benefits? Or maybe some way to easily use Protocol Buffers instead of JSON for Rails web requests?

[1] http://zserge.com/jsmn.html

There are no comments on this comment yet.