-
Notifications
You must be signed in to change notification settings - Fork 1
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
Use std::string inside BwString #8
Conversation
src/Player.cpp
Outdated
@@ -5,6 +5,12 @@ | |||
#include <BWAPI/TechType.h> | |||
#include <BWAPI/Color.h> | |||
|
|||
#include <Types.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не надо
src/String.cpp
Outdated
} | ||
|
||
void String_release(String* self) { | ||
delete[] self->data; | ||
assert(self); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут проверка не нужна
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Семантика этой проверки не в том, что «delete надо вызывать на ненулевом указателе», а в том, что «по логике программы сюда должны передать ненулевой указатель. Если он нулевой, что-то сильно не так в вызывающем коде».
То есть, я тут проверяю контракт на сам вызов.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ну ок
c7cd52e
to
118d9f1
Compare
No description provided.