ALL
new() and make() in GoLang
GoLang is a modern, statically typed, compiled programming language designed for building scalable, concurrent, and efficient software. It provides various built-in functions and features that help developers write concise and efficient code. Among them are the new() and make() functions, which may appear similar at first glance but serve different purposes in GoLang and are crucial for memory allocation and data initialization.In this blog article, we will explore the differences between the new() and make() functions, and understand when and how to use them effectively.new() and make()new() ...
malloc/free and new/delete in C++
malloc and free are C++/C language standard library functions, while new/delete are operator of C++. They can be used to allocate dynamic memory and free memory in C++ programs malloc/free can not meet the requirements of dynamic objects creation. Object needs to call the constructor to initialize the object when creating, the object needs to call the destructor before it is destroyed Since malloc() and free() are library functions rather than operators, the compiler has no control permissions on them, so it can not impose the task of object construction and destruction on malloc() and f...