refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게 [공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류. 문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인). - Topic_Programming → Domain_Programming (내부 구조 보존) - Topic_Graphic → Domain_Design - Topic_Business → Domain_Product - Topic_General → Domain_General - _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning), Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing) - 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서) - 빈 폴더 정리 (memory/procedures) - 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
---
|
||||
id: c-macros
|
||||
title: "C Preprocessor and Macros"
|
||||
category: "Programming_Language"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["#define", "#ifdef", "conditional compilation", "C 전처리기와 매크로"]
|
||||
duplicate_of: ""
|
||||
source_trust_level: "B"
|
||||
confidence_score: 0.86
|
||||
created_at: 2026-07-04
|
||||
updated_at: 2026-07-04
|
||||
review_reason: ""
|
||||
merge_history: []
|
||||
tags: ["c", "programming-language", "w3schools", "preprocessor", "macros"]
|
||||
raw_sources: ["https://www.w3schools.com/c/c_macros.php"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[C Preprocessor and Macros]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
`#define PI 3.14` doesn't create a variable at all — the preprocessor performs a pure TEXT REPLACEMENT of every literal occurrence of `PI` with `3.14` BEFORE the compiler ever sees the code, meaning macros exist in an entirely different phase from variables/constants (which are compiled), which is also why parameterized macros like `SQUARE(x)` need careful parenthesization — they're substituting raw text, not evaluating an expression with real function-call semantics. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **Preprocessor** — runs BEFORE actual compilation; handles directives (lines starting with `#`) like including files and defining macros. [S1]
|
||||
- **`#include`** — angle brackets `< >` for standard libraries, double quotes `" "` for your own header files. [S1]
|
||||
- **`#define NAME value`** — creates a macro; every literal occurrence of `NAME` in the code is textually replaced with `value` before compilation. [S1]
|
||||
- **Parameterized macros** — `#define SQUARE(x) ((x) * (x))` behaves like a function shortcut, but is really TEXT SUBSTITUTION, so careful parenthesization is required to avoid operator-precedence mistakes. [S1]
|
||||
- **`#ifdef` / `#ifndef`** — conditional compilation; includes or skips code blocks depending on whether a macro is defined, useful for debug builds or program variants. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
- Basic value macro: `#define PI 3.14 int main() { printf("Value of PI: %.2f\n", PI); return 0; }`. [S1]
|
||||
- Parameterized macro: `#define SQUARE(x) ((x) * (x)) printf("Square of 4: %d\n", SQUARE(4));`. [S1]
|
||||
- Conditional compilation gated on a defined macro: `#define DEBUG int main() { #ifdef DEBUG printf("Debug mode is ON\n"); #endif return 0; }` — if `DEBUG` were undefined, that block would be skipped entirely. [S1]
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
||||
- **매크로는 변수가 아니라 텍스트 치환**: #define PI 3.14는 컴파일 전에 코드상의 PI를 문자 그대로 3.14로 바꿔치기하는 전처리 단계 작업이며, 변수나 상수처럼 컴파일되는 개념이 아니라는 점이 확인됨. [S1]
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
DEBUG 매크로가 정의되어 있을 때만 디버그 메시지를 출력하는 조건부 컴파일이 원문에서 직접 실전 활용 사례로 제시됨(디버깅이나 프로그램 버전 분기에 유용). [S1]
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Conditional compilation — code included only if a macro is defined (C):
|
||||
```c
|
||||
#define DEBUG
|
||||
int main() {
|
||||
#ifdef DEBUG
|
||||
printf("Debug mode is ON\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
## ✅ 검증 상태 및 신뢰도
|
||||
- **상태:** draft
|
||||
- **검증 단계:** conceptual
|
||||
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
||||
- **신뢰 점수:** 0.86
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[C Tutorial]]
|
||||
- **관련 개념:** [[C Type Conversion]], [[C Organize Code]], [[C Null]]
|
||||
- **참조 맥락:** 전처리기와 매크로 — NULL(Null) 챕터로 이어짐.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — C Preprocessor and Macros — https://www.w3schools.com/c/c_macros.php
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-07-04: Initial draft synthesized from the W3Schools "C Preprocessor and Macros" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user