Skip to content

Commit

Permalink
<debugging> : コード例が間違ってたのを修正 #1232
Browse files Browse the repository at this point in the history
  • Loading branch information
faithandbrave committed Sep 18, 2024
1 parent 6572301 commit a4346b7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
9 changes: 6 additions & 3 deletions reference/debugging/breakpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ double g(double a, double b) {
double f(double a, double b) {
double ret = g(a, b);
if (std::isnan(ret)) {
// 演算結果でNaNが発生したらブレークし
if (std::isnan(ret) || std::isinf(ret)) {
// 演算結果でNaNかinfが発生したらブレークし
// デバッガでパラメータ (ローカル変数) などを確認する
std::breakpoint();
}
return ret;
}
int main() {
Expand All @@ -61,9 +62,11 @@ int main() {
```
* std::breakpoint[color ff0000]
* std::isnan[link /reference/cmath/isnan.md]
* std::isinf[link /reference/cmath/isinf.md]

### 出力
### 出力例
```
inf
```


Expand Down
9 changes: 6 additions & 3 deletions reference/debugging/breakpoint_if_debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ double g(double a, double b) {

double f(double a, double b) {
double ret = g(a, b);
if (std::isnan(ret)) {
// 演算結果でNaNが発生したらブレークし
if (std::isnan(ret) || std::isinf(ret)) {
// 演算結果でNaNかinfが発生したらブレークし
// デバッガでパラメータ (ローカル変数) などを確認する
std::breakpoint_if_debugging();
}
return ret;
}

int main() {
Expand All @@ -63,9 +64,11 @@ int main() {
```
* std::breakpoint_if_debugging[color ff0000]
* std::isnan[link /reference/cmath/isnan.md]
* std::isinf[link /reference/cmath/isinf.md]
### 出力
### 出力例
```
inf
```
Expand Down
9 changes: 6 additions & 3 deletions reference/debugging/is_debugger_present.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@ double g(double a, double b) {
double f(double a, double b) {
double ret = g(a, b);
if (std::isnan(ret)) {
// 演算結果でNaNが発生したらブレークし
if (std::isnan(ret) || std::isinf(ret)) {
// 演算結果でNaNかinfが発生したらブレークし
// デバッガでパラメータ (ローカル変数) などを確認する
if (std::is_debugger_present()) {
std::breakpoint();
}
}
return ret;
}
int main() {
Expand All @@ -72,9 +73,11 @@ int main() {
* std::is_debugger_present[color ff0000]
* std::breakpoint[link breakpoint.md]
* std::isnan[link /reference/cmath/isnan.md]
* std::isinf[link /reference/cmath/isinf.md]

### 出力
### 出力例
```
inf
```


Expand Down

0 comments on commit a4346b7

Please sign in to comment.