Apply suggestions from code review

Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
This commit is contained in:
ihsinme
2021-01-29 13:41:45 +03:00
committed by GitHub
parent c8eeb5f73e
commit bdbf5a4fae

View File

@@ -8,7 +8,9 @@ void badFunction(const int *source, std::size_t length) noexcept {
void goodFunction(const int *source, std::size_t length) noexcept {
try {
int * dest = new int[length];
} catch(std::bad_alloc)
} catch(std::bad_alloc) {
// ...
}
std::memset(dest, 0, length);
// ..
}
@@ -16,7 +18,9 @@ void goodFunction(const int *source, std::size_t length) noexcept {
void badFunction(const int *source, std::size_t length) noexcept {
try {
int * dest = new (std::nothrow) int[length];
} catch(std::bad_alloc)
} catch(std::bad_alloc) {
// ...
}
std::memset(dest, 0, length);
// ..
}