For fun I implemented a lightweight exception mechanism for C that allows writing transactional code. This is what it looks like:
int device_create(device_t **odevice)
{
throwbase(-1); // makes this function "throwing" with a default return value of -1.
device_t *device = malloc(sizeof *device);
check(device);