mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
bad type
This commit is contained in:
parent
d6ffbfdcc2
commit
9d4fc0b5cb
|
@ -12284,7 +12284,7 @@ One strategy is to add a `valid()` operation to every resource handle:
|
||||||
// handle error or exit
|
// handle error or exit
|
||||||
}
|
}
|
||||||
|
|
||||||
Ifstream fs("foo"); // not std::ifstream: valid() added
|
ifstream fs("foo"); // not std::ifstream: valid() added
|
||||||
if (!fs.valid()) {
|
if (!fs.valid()) {
|
||||||
// handle error or exit
|
// handle error or exit
|
||||||
}
|
}
|
||||||
|
@ -12721,7 +12721,7 @@ In such cases, "crashing" is simply leaving error handling to the next level of
|
||||||
|
|
||||||
Most programs cannot handle memory exhaustion gracefully anyway. This is roughly equivalent to
|
Most programs cannot handle memory exhaustion gracefully anyway. This is roughly equivalent to
|
||||||
|
|
||||||
void f(Int n)
|
void f(int n)
|
||||||
{
|
{
|
||||||
// ...
|
// ...
|
||||||
p = new X[n]; // throw if memory is exhausted (by default, terminate)
|
p = new X[n]; // throw if memory is exhausted (by default, terminate)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user