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

Use std::string inside BwString #8

Merged
merged 1 commit into from
May 28, 2017
Merged

Use std::string inside BwString #8

merged 1 commit into from
May 28, 2017

Conversation

0x7CFE
Copy link
Member

@0x7CFE 0x7CFE commented May 9, 2017

No description provided.

@0x7CFE 0x7CFE requested a review from kpp May 9, 2017 10:04
src/Player.cpp Outdated
@@ -5,6 +5,12 @@
#include <BWAPI/TechType.h>
#include <BWAPI/Color.h>

#include <Types.h>
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут проверка не нужна

Copy link
Member Author

@0x7CFE 0x7CFE May 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Семантика этой проверки не в том, что «delete надо вызывать на ненулевом указателе», а в том, что «по логике программы сюда должны передать ненулевой указатель. Если он нулевой, что-то сильно не так в вызывающем коде».

То есть, я тут проверяю контракт на сам вызов.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ну ок

@kpp kpp force-pushed the master branch 2 times, most recently from c7cd52e to 118d9f1 Compare May 11, 2017 15:31
@kpp kpp added this to the Version 1.0.0 milestone May 13, 2017
@kpp kpp changed the title Move semantics in String implementation, safe_cast<>, etc Use std::string inside BwString May 28, 2017
@kpp kpp merged commit ee3b224 into master May 28, 2017
@kpp kpp deleted the no_copy branch May 28, 2017 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants