Discussion on: Zig Interfaces for the Uninitiated, an update

guidorice profile image

Really nice post, thanks @kilianvounckx !

Newb Question: the linked post "the-missing-zig-polymorphism-reference" says:

You could also use anyopaque but it introduces alignment problems that only complicates the solution.

The zig language reference is a bit muddled about this, as it does say to use anyopaque for type erased pointers. But it also says anyopaque is for interop with C void pointers. (and it seems c_void was renamed to anyopaque at some time).

I would definitely lean towards simplify just using usize as in the linked post. But I'm probably not understanding the pros/cons?