Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No. You don't mess around with the language like that.

This is how you do it:

https://github.com/codr7/hacktical-c/tree/main/vector



This is the type erasure approach, whose cons are mentioned in the article.


It's the C approach, strong typing doesn't mix well with raw memory access.


The very article we are discussing shows you a way how to do that type safely in C. It uses #include which is a very idiomatic way to do this in C, and an example where a preprocessor-based approach is more flexible, than e.g. a module system.


Nim is strongly typed and allows raw memory access just fine.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: