-
Notifications
You must be signed in to change notification settings - Fork 187
Closed
Labels
contributor friendlythis issue is limited in scope and/or knowledge of Cubyz internals, good for newcomersthis issue is limited in scope and/or knowledge of Cubyz internals, good for newcomers
Milestone
Description
The problem:
Generic functions often have an interface involving an anyopaque pointer *const fn(self: *anyopaque, ...) void
However in practive we often have functions with specific pointers: pub fn generate(self: *Stalagmite, ...)
Now to convert them it is convenient to use a @ptrCast, however this is completely unsafe, since the arguments are not checked at all.
So ideally we could make a safer cast using reflection to first check if the arguments match in length and size and alignment, and then again do the ptrCast in the end.
This would make the access a bit more annoying because we'd explicitly have to supply the result type, but the improvements to safety would be definitely worth it.
Metadata
Metadata
Assignees
Labels
contributor friendlythis issue is limited in scope and/or knowledge of Cubyz internals, good for newcomersthis issue is limited in scope and/or knowledge of Cubyz internals, good for newcomers