3 ms·
> there is no such thing as a list or dynamic array in C, at best one can build a leaky abstraction based on structs and pointers with almost zero type safety
by Crinus 7y ago
> there is no such thing as a list or dynamic array in C, at best one can build a leaky abstraction based on structs and pointers with almost zero type safety
First of all, type safety is not necessary to create something fast which is what the original comment was all about and everything i'm writing is in the context of mmoez writing how modern tools enable individuals to do work that decades ago would need entire teams and my reply to that was that this applies to some types of tools and someone who knows C++17 enough to make such a game like those made decades ago wont gain implementation speed from the language itself as opposed using something like C89. I repeat this context because i have a feeling from your replies that you are taking my comments out of it.
Second, you can use the preprocessor to create type safe lists, dynamic arrays, etc. In fact SGLIB does exactly that, this is why you pass a type to the macros that declares your list types and functions. But outside of SGLIB's approach you can also use include files as templates with parameters passed outside of it. Here is an example i wrote some weeks ago:
https://news.ycombinator.com/item?id=19879059 https://news.ycombinator.com/item?id=19879059
This creates types and functions based on the parameters you give to the header.
> Anything is better than C at providing abstractions for building games, because any language offers more than procedures, crude arrays and structs.
Also a somewhat decent macro system, but so does C++. However i never argued that C is good at providing abstractions (as i show above you can, but it can be a PITA). C++ and some other languages are better than that, sure.
What i argued about is that those abstractions will not cause someone who has enough knowledge to write a game like the one submitted here in C++17 to make it "that would need teams decades ago" faster than if he'd used something like C89. In other words, considering the type of project we're discussing about, even if he gains any speed, it'd be minimal.
- fooker 7y agoAll that versus a vector<int> , unordered_map<string, Foo> :)