A Zig Diary

As it turned out I happened to help out with fixing a space to host a zig meetup here in Stockholm at the place where I work. However I haven’t written a single line of zig in my life… I felt that it might be worth doing something about that :D

If you don’t know, zig is a new systems programming language!

I have found zig quite intriguing for a while now but I haven’t had the time to look into it so this sounded like an as good excuse as any! I’ll try something new with this post and just write as I go and document my success/failure/reflections, this might make it a bit “rambly” :)

Read More

When memcpy() change!

To start of, yes, I know that this article touch undefined behavior and that all bets are off!

I am currently working on a bigger post on swapping memory that is THIS close to being done… any day now (he has been saying the last year!).

However this topic popped up and I was wondering if it was worth making the other post longer or just make a small one about it. As the other post is already quite big I opted for a shorter one here.

Read More

Macros and Lambdas

Time for a short post on using lambdas to construct macros… that was a sentence that will be able to trigger 2 camps in one go :D

Defer

First of, using lambdas to implement a defer() is really neat, however others has already written about that so that I don’t have to!

A Defer Statement For C++11

Call once

So from my end I’ll start of with a quick one for constructing a macro that only does something once, lets call it IS_FIRST_CALL(). This can be used for things such as only logging something once or just asserting once. I’ll leave it to the reader to decide if this is a “good” thing but it is absolutely things I have seen “in the wild”.

Read More