e9cbf23ab5
이전 재구성 작업에서 Dev/ 폴더가 누락되었던 것을 반영. - Dev/Topic_Programming(중첩 폴더, 78개)은 Dev 자체 최상위 폴더들 (Architecture/Conventions/Engineering_Intelligence 등)과 완전 중복이라 제거. - Dev 최상위 엔지니어링 지식 폴더(Architecture/Conventions/Engineering_Intelligence/ Failure_Library/Generalized_Principles/Language/Pattern_Catalog/Platform_Guides/ Subsystems, 77개)는 이미 Topic_Programming/Topic_Programming에 더 최신 버전이 존재해 중복 제거(고유 콘텐츠 1개는 예외 처리하여 이동 보존). - Dev의 W3Schools 언어 튜토리얼 폴더(Topic_C/CPP/CSS/CSharp/HOWTO/HTML/Java/ JavaScript/PHP/Python/SQL/W3CSS, 1201개)는 전부 Topic_Programming 하위로 이동. - 에이전트 운영 상태(.astra/docs)는 그대로 유지, 콘텐츠 폴더만 정리. - Topic_Programming 최종 문서 수: 2784 → 3985.
3.5 KiB
3.5 KiB
id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
| id | title | category | status | verification_status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | created_at | updated_at | review_reason | merge_history | tags | raw_sources | applied_in | github_commit | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cpp-function-default | C++ Default Parameters | Programming_Language | draft | conceptual |
|
B | 0.86 | 2026-07-04 | 2026-07-04 |
|
|
CPP Default Parameters
🎯 한 줄 통찰 (One-line insight)
This is a feature C never had — a function parameter can carry a FALLBACK VALUE (string country = "Norway") that's automatically used ONLY when the caller omits that argument entirely, meaning myFunction() and myFunction("USA") are BOTH valid calls to the SAME function with different effective parameter counts, something C's rigid argument-count matching never permitted. [S1]
🧠 핵심 개념 (Core concepts)
- Default parameter value (
param = value) — assigns a fallback value used when the caller omits that argument. [S1] - "Optional parameter" — the common name for a parameter with a default value. [S1]
- Callable with or without the argument — the SAME function accepts calls with a different number of arguments, unlike C where argument count must always match parameter count exactly. [S1]
📖 세부 내용 (Details)
- Default value used when the argument is omitted:
void myFunction(string country = "Norway") { cout << country << "\n"; } myFunction("Sweden"); // Sweden myFunction("India"); // India myFunction(); // Norway (default) myFunction("USA"); // USA. [S1]
⚖️ 모순 및 업데이트 (Contradictions & updates)
- C에는 없던 기본 매개변수 기능: 인자를 생략하면 자동으로 기본값이 쓰이는 "선택적 매개변수(optional parameter)"는 C의 고정된 인자 개수 일치 규칙과 달리, 같은 함수를 다른 개수의 인자로 호출할 수 있게 해준다는 점이 확인됨. [S1]
🛠️ 적용 사례 (Applied in summary)
현재 발견된 실제 적용 사례가 없습니다 — 국가 매개변수를 생략하면 "Norway"가 기본으로 쓰이는 예제가 선택적 매개변수의 실전 활용을 보여준다. [S1]
💻 코드 패턴 (Code patterns)
A default parameter value used when the argument is omitted (C++):
void myFunction(string country = "Norway") {
cout << country << "\n";
}
int main() {
myFunction("Sweden"); // Sweden
myFunction(); // Norway (default used)
return 0;
}
✅ 검증 상태 및 신뢰도
- 상태: draft
- 검증 단계: conceptual
- 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
- 신뢰 점수: 0.86
- 중복 검사 결과: 신규 생성 (New discovery)
🔗 지식 그래프 (Knowledge Graph)
- 상위/루트: C++ Tutorial
- 관련 개념: CPP Function Param, CPP Function Overloading, C Functions Parameters
- 참조 맥락: 기본 매개변수 — 함수 오버로딩(Function Overloading) 챕터로 이어짐.
📚 출처 (Sources)
- [S1] W3Schools — C++ Default Parameters — https://www.w3schools.com/cpp/cpp_function_default.asp
📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "C++ Default Parameters" page (Astra wiki-curation, P-Reinforce v3.1 format).