1cfd3bbb56
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고, Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
71 lines
4.0 KiB
Markdown
71 lines
4.0 KiB
Markdown
---
|
|
id: cpp-debugging
|
|
title: "C++ Debugging"
|
|
category: "Programming_Language"
|
|
status: "draft"
|
|
verification_status: "conceptual"
|
|
canonical_id: ""
|
|
aliases: ["print debugging", "breakpoints", "debugging vs exception handling", "C++ 디버깅"]
|
|
duplicate_of: ""
|
|
source_trust_level: "B"
|
|
confidence_score: 0.84
|
|
created_at: 2026-07-04
|
|
updated_at: 2026-07-04
|
|
review_reason: ""
|
|
merge_history: []
|
|
tags: ["cpp", "programming-language", "w3schools", "debugging"]
|
|
raw_sources: ["https://www.w3schools.com/cpp/cpp_debugging.asp"]
|
|
applied_in: []
|
|
github_commit: ""
|
|
---
|
|
|
|
# [[CPP Debugging]]
|
|
|
|
## 🎯 한 줄 통찰 (One-line insight)
|
|
The closing distinction ("debugging is about finding/fixing errors DURING DEVELOPMENT; exception handling is dealing with errors WHILE THE PROGRAM RUNS") is IDENTICAL to C's Debugging chapter's conclusion — except in C++, "exception handling" now refers to a REAL language feature (`try`/`catch`) rather than C's manual NULL-checking workarounds, meaning the conceptual division between the two development-vs-runtime phases stays the same across languages, but the runtime-side tool it points to is genuinely more powerful in C++. [S1]
|
|
|
|
## 🧠 핵심 개념 (Core concepts)
|
|
- **Print debugging** — using `cout` to trace how far execution gets before something goes wrong. [S1]
|
|
- **Checking variable values** — printing intermediate results to catch LOGIC errors, not just crashes. [S1]
|
|
- **IDE debuggers** — breakpoints, line-by-line stepping, variable-watching; recommended as a step up once comfortable with print debugging. [S1]
|
|
- **Reading error messages literally** — the compiler states exactly what's wrong and where. [S1]
|
|
- **Debugging vs. exception handling** — debugging finds/fixes mistakes DURING DEVELOPMENT; exception handling responds to problems WHILE THE PROGRAM RUNS — the same C-established distinction, but now backed by C++'s real try/catch mechanism instead of C's manual workarounds. [S1]
|
|
|
|
## 📖 세부 내용 (Details)
|
|
- Print debugging locating a crash point: `cout << "Before division\n"; int z = x / y; // crashes cout << "After division\n"; // never runs`. [S1]
|
|
- Logic-error detection via variable printing: `int result = x - y; cout << "Result: " << result << "\n"; // expected 15, got 5 — wrong operator used`. [S1]
|
|
|
|
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
|
- **디버깅과 예외 처리의 구분은 C와 동일하지만 예외 처리 자체는 더 강력함**: 개발 중 디버깅 vs 실행 중 에러 대응이라는 구분은 C와 같지만, C++에서는 그 "실행 중 대응" 수단이 진짜 언어 차원의 try/catch라는 점이 C의 수동적 우회책과 대비됨. [S1]
|
|
|
|
## 🛠️ 적용 사례 (Applied in summary)
|
|
현재 발견된 실제 적용 사례가 없습니다 — cout으로 코드 실행 지점을 추적해 크래시 위치를 찾는 print debugging이 실전에서 가장 먼저 시도하는 디버깅 기법으로 권장됨. [S1]
|
|
|
|
## 💻 코드 패턴 (Code patterns)
|
|
Print debugging to locate exactly where a program crashes (C++):
|
|
```cpp
|
|
int x = 10;
|
|
int y = 0;
|
|
cout << "Before division\n"; // Debug output
|
|
int z = x / y; // Crashes!
|
|
cout << "After division\n"; // Never runs — crash located
|
|
```
|
|
|
|
## ✅ 검증 상태 및 신뢰도
|
|
- **상태:** draft
|
|
- **검증 단계:** conceptual
|
|
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
|
- **신뢰 점수:** 0.84
|
|
- **중복 검사 결과:** 신규 생성 (New discovery)
|
|
|
|
## 🔗 지식 그래프 (Knowledge Graph)
|
|
- **상위/루트:** [[C++ Tutorial]]
|
|
- **관련 개념:** [[CPP Input Validation]], [[CPP Exceptions]], [[CPP Files]]
|
|
- **참조 맥락:** 에러 및 디버깅 섹션 마지막 — 파일 입출력(Files) 섹션으로 이어짐.
|
|
|
|
## 📚 출처 (Sources)
|
|
- [S1] W3Schools — C++ Debugging — https://www.w3schools.com/cpp/cpp_debugging.asp
|
|
|
|
## 📝 변경 이력 (Change history)
|
|
- 2026-07-04: Initial draft synthesized from the W3Schools "C++ Debugging" page (Astra wiki-curation, P-Reinforce v3.1 format).
|