Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange mix of malloc and new #50

Open
supuflounder opened this issue Aug 2, 2018 · 0 comments
Open

Strange mix of malloc and new #50

supuflounder opened this issue Aug 2, 2018 · 0 comments

Comments

@supuflounder
Copy link

While this is not an actual error, it does not represent Best Practice in C++ programming. In a number of places, such as in AdafruitIO_Group::_init, both malloc and new are used. The use of bare malloc in C++ is frowned upon. It is normally hidden inside the new operator. What is odd is that the computations are of the form
var = (char *)malloc(e);
for e being some expression. In C++, this can (and should) be written as
var = new char[e];
and therefore the odd mix of malloc/free and new/delete can be avoided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants