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.3 KiB
3.3 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-strings-length | C++ String Length | Programming_Language | draft | conceptual |
|
B | 0.83 | 2026-07-04 | 2026-07-04 |
|
|
CPP String Length
🎯 한 줄 통찰 (One-line insight)
length() and size() are explicitly stated to be EXACT ALIASES for each other — not two functions that happen to behave similarly, but literally the same operation under two names — meaning code encountered "in the wild" using size() instead of length() isn't using a different technique, just a different spelling of the identical call, and the choice between them is purely stylistic. [S1]
🧠 핵심 개념 (Core concepts)
.length()— returns the number of characters in a string. [S1].size()— an exact ALIAS of.length(); both do precisely the same thing. [S1]- No functional difference — unlike C's
sizeofvsstrlendistinction (which measure genuinely different things), C++'slength()/size()pair is purely a naming convenience with zero behavioral difference. [S1]
📖 세부 내용 (Details)
- Getting length via
.length():string txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; cout << txt.length(); // 26. [S1] - The identical result via
.size():cout << txt.size(); // 26, same result. [S1]
⚖️ 모순 및 업데이트 (Contradictions & updates)
- length()와 size()는 완전한 별칭: C의 sizeof/strlen처럼 서로 다른 것을 측정하는 관계가 아니라, C++의 length()와 size()는 정확히 동일한 동작을 하는 두 개의 이름일 뿐이라는 점이 명시적으로 확인됨. [S1]
🛠️ 적용 사례 (Applied in summary)
현재 발견된 실제 적용 사례가 없습니다 — 다른 사람의 C++ 코드에서 size()를 볼 수도 있다는 점을 미리 알아두면 실전 코드 독해에 도움이 된다. [S1]
💻 코드 패턴 (Code patterns)
length() and size() are exact aliases of each other (C++):
string txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
cout << txt.length(); // 26
cout << txt.size(); // 26, identical result
✅ 검증 상태 및 신뢰도
- 상태: draft
- 검증 단계: conceptual
- 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
- 신뢰 점수: 0.83
- 중복 검사 결과: 신규 생성 (New discovery)
🔗 지식 그래프 (Knowledge Graph)
- 상위/루트: C++ Tutorial
- 관련 개념: CPP Strings Input, CPP Strings Namespace, C Strings Functions
- 참조 맥락: 문자열 길이 — 네임스페이스 생략(Strings Namespace) 챕터로 이어짐.
📚 출처 (Sources)
- [S1] W3Schools — C++ String Length — https://www.w3schools.com/cpp/cpp_strings_length.asp
📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "C++ String Length" page (Astra wiki-curation, P-Reinforce v3.1 format).