General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Anony Mousse
LaurieWired
comments
Comments by "Anony Mousse" (@anon_y_mousse) on "Mastering Memory: Allocation Techniques in C, C++, and ARM Assembly" video.
In idiomatic modern C++, you shouldn't manually allocate memory at all. Better to either use std::vector if you want dynamic storage, or std::array to allocate on the stack. Calling to an allocator to store a single item is rather unconventional too. C doesn't require you to cast a void pointer to any other pointer type when assigning, and you should have mentioned that if someone wants the data to be initialized upon allocating, that they could use calloc() instead of malloc(). Of course, if you really need to manually allocate, you can still use all of the standard C functions in C++ and assembly, and in C++ you would need to cast the output of malloc(). Also, you can call `gcc` to both assemble and link, since you're using `as` anyway.
3