--- id: cpp-comments title: "C++ Comments" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["single-line comments", "multi-line comments", "C++ 주석"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.83 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["cpp", "programming-language", "w3schools", "comments"] raw_sources: ["https://www.w3schools.com/cpp/cpp_comments.asp"] applied_in: [] github_commit: "" --- # [[CPP Comments]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) Unlike the C tutorial, which highlighted a historical constraint (single-line `//` comments only became standard in C99), the C++ chapter presents both `//` and `/* */` as equally native from the start with no such caveat β€” reflecting that C++ never carried C's pre-1999 single-line-comment limitation, since C++ has supported `//` since its earliest standardization. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Single-line comments (`//`)** β€” text from `//` to end of line is ignored by the compiler. [S1] - **Multi-line comments (`/* */`)** β€” text between the markers is ignored, regardless of line count. [S1] - **Stylistic convention** β€” `//` for short comments, `/* */` for longer ones; entirely up to the developer. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Single-line comment before code: `// This is a comment cout << "Hello World!";`. [S1] - Single-line comment at end of a line: `cout << "Hello World!"; // This is a comment`. [S1] - Multi-line comment: `/* The code below will print the words Hello World! to the screen, and it is amazing */ cout << "Hello World!";`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - ν˜„μž¬κΉŒμ§€ 발견된 λͺ¨μˆœ 사항 μ—†μŒ (No contradictions found in available sources). ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” 짧은 μ£Όμ„μ—λŠ” //, κΈ΄ μ„€λͺ…μ—λŠ” /* */λ₯Ό μ“°λŠ” 관행이 C 챕터와 λ™μΌν•˜κ²Œ ꢌμž₯됨. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Single-line comment used to explain a line of code (C++): ```cpp cout << "Hello World!"; // This is a comment ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.83 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[C++ Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CPP Statements]], [[CPP Output]] - **μ°Έμ‘° λ§₯락:** 주석 문법 β€” 좜λ ₯(Output) μ±•ν„°λ‘œ 이어짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” C++ Comments β€” https://www.w3schools.com/cpp/cpp_comments.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "C++ Comments" page (Astra wiki-curation, P-Reinforce v3.1 format).