Comments by "" (@pierreollivier1) on "Cs Biggest Mistake | Prime Reacts" video.
-
totally agree, the one thing I really don't like with a low of the newer, language, is that they try so hard, to have you write the least amount of code possible, and for certain domains it's fine, but if you take a language like rust/python/cpp, they have so much of those abstractions that in my opinion if there isn't some strict guidelines the codebase can become very innaccessible to maintain. Whereas C is by nature such a simple language, that the few abstractions needed for a project kind of standout naturally and are really easier to understand, generally speaking my favourite feature in C is that for every problem you encounter, the only solution the language is forcing you into is to write more C code. In other language, you have to use niche container class, external libraries etc it can become hard to follow.
3
-
The simplest way I think, is to use a composite type, with typedef, you create a struct, that contains a void* data, a size_t size, and an enum for the type, that is declared with the type width, I use this a lot you just typedef it into a nice array_t, or t_array and boom you have a simple and easy to use array. you can even go a step further, and use generic functions that are only facade to fonctions pointers switch statements to redirect your array to the correct type specific functions, based on the value of your enum. ( and in some cases if the compiler is able to see that your functions are only there to redirect your array to another functions, the compiler might replace your switch statement by a look up table reducing a bit the overhead).
1
-
1