C++ Redefine

Languages: [EN] English | [KO] 한국어

Images: [Hide]

C++ Redefine: A Structural Software Architecture Model
C++ Redefine: 구조 기반 소프트웨어 아키텍처 모델

<Even in death I still compile>

C++ Redefine: c++ -20 (cpp negative 20) v0.0.2

  1. Introduction 서론
    • This article proposes a programming model evolved from an architectural model originally designed and production-validated through the AP Migration Framework, an enterprise-scale automation system developed in a constrained execution environment without advanced language-level features. Rather than relying on compiler-supported ownership or language abstractions, the architecture established explicit execution flow, modular composition, and resource management through structural design. These validated architectural principles are extended into a C++ runtime model through context-based ownership, namespace-based access control, and function pointer-based execution pipelines. 본 글은 고급 언어 수준 기능이 제공되지 않는 제약된 실행 환경에서 개발되어 실제 기업 환경에서 검증된 AP Migration Framework의 아키텍처를 기반으로 발전한 프로그래밍 모델을 제안한다. 컴파일러가 제공하는 소유권 모델이나 언어 추상화에 의존하지 않고, 명시적인 실행 흐름, 모듈 구성, 자원 관리를 구조적 설계만으로 구현하였으며, 이러한 검증된 아키텍처 원칙을 컨텍스트 기반 소유권, 네임스페이스 기반 접근 제어, 함수 포인터 기반 실행 파이프라인을 갖춘 C++ 런타임 모델로 확장하였다.
    • This architecture minimizes structural dependency on C++-specific features, and with adjustments to certain elements (e.g., namespace-based access control), the same design model can be applied in C environments. 본 아키텍처는 C++ 고유 기능에 대한 의존성을 구조적으로 최소화하였으며, 일부 요소(예: 네임스페이스 기반 접근 제어)를 조정할 경우 C 환경에서도 동일한 설계 모델을 적용할 수 있다.
    • This document is not a conceptual proposal, but a verified implementation spec from an actively running project Smeltrix 본 문서는 개념 제안이 아니라 실제 운영 중인 프로젝트 Smeltrix 에서 검증 된 구현 스펙이다.
  2. Namespace Ownership Model 네임스페이스 소유권 모델 (Namespace Ownership)
    • When referencing the full namespace path, specify an absolute path (::Ex). 네임스페이스 전체 경로 참조 시 절대경로(::Ex)를 명시한다.
    • All code must be separated by namespace. A single file may only use one namespace. 모든 코드는 네임스페이스 단위로 분리되며, 하나의 파일은 하나의 네임스페이스만 사용한다.
    • Ownership of a context belongs exclusively to main.cpp of the same namespace. Sub-namespaces can naturally access the parent context without argument passing. 컨텍스트의 소유권은 동일 네임스페이스의 main.cpp에만 귀속된다. 하위 네임스페이스는 상위 컨텍스트에 자연스럽게 접근 가능하다.
    • The file boundary is the access boundary 파일 경계가 곧 접근 경계 class-based public/private access control is replaced by namespace-level static encapsulation within each file. class 기반의 public/private 접근 제어는 각 파일의 네임스페이스 내부 static 캡슐화 방식으로 대체된다.
    • TransFunk
      The name TransFunk is derived from the combination of "Transistor" and "Function". Similar to how a transistor controls the flow of electrical signals as a fundamental hardware component, the TransFunk layer manages connections and control flow between functional components. The TransFunk layer is a dedicated abstraction layer within the Smeltrix runtime, designed to manage connections and control flow between functional components. It is composed of two separated layers: Pipeline and Flowline.
      • Pipeline Pipeline is responsible for processing flow, integrated control, data access, and the structural components required for communication between modules. UI and externally exposed APIs access the runtime exclusively through Pipeline, maintaining a clear boundary between internal implementation and external interfaces while limiting direct dependencies between modules. Pipeline은 처리 흐름, 통합 제어, 데이터 접근 및 모듈 간 연결에 필요한 구조를 담당한다. UI 및 외부 노출 API는 모두 Pipeline을 통해 접근하며, 이를 통해 내부 구현과 외부 인터페이스 사이의 경계를 유지하고 모듈 간 직접적인 의존성을 제한한다.
      • Flowline Flowline is a low-level connection layer responsible for direct connection paths and data flow control. Unlike a conventional Hardware Abstraction Layer (HAL), it focuses on maintaining efficient direct communication paths and controlling the flow between targets, hardware, and external interfaces. Flowline은 단순한 하드웨어 추상화 계층(HAL)이 아닌, 대상 간 직접 연결과 데이터 흐름 제어를 담당하는 저수준 연결 계층이다. 하드웨어 및 외부 인터페이스와의 효율적인 연결 경로를 제공하며, 필요한 경우 직접적인 제어 흐름을 유지할 수 있도록 설계되었다.
      TransFunk라는 명칭은 Transistor와 Function의 결합으로, 하드웨어의 기본 단위인 트랜지스터가 전기적 흐름을 제어하는 것처럼 기능 단위 간 연결과 흐름 제어를 담당하는 계층이라는 의미를 가진다. TransFunk 계층은 Smeltrix 런타임 내부의 전용 추상화 계층으로, 기능 단위 간 연결과 제어 흐름을 담당한다. TransFunk는 Pipeline과 Flowline으로 분리되어 구성된다.
      • Pipeline Pipeline is responsible for processing flow, integrated control, data access, and the structural components required for communication between modules. UI and externally exposed APIs access the runtime exclusively through Pipeline, maintaining a clear boundary between internal implementation and external interfaces while limiting direct dependencies between modules. Pipeline은 처리 흐름, 통합 제어, 데이터 접근 및 모듈 간 연결에 필요한 구조를 담당한다. UI 및 외부 노출 API는 모두 Pipeline을 통해 접근하며, 이를 통해 내부 구현과 외부 인터페이스 사이의 경계를 유지하고 모듈 간 직접적인 의존성을 제한한다.
      • Flowline Flowline is a low-level connection layer responsible for direct connection paths and data flow control. Unlike a conventional Hardware Abstraction Layer (HAL), it focuses on maintaining efficient direct communication paths and controlling the flow between targets, hardware, and external interfaces. Flowline은 단순한 하드웨어 추상화 계층(HAL)이 아닌, 대상 간 직접 연결과 데이터 흐름 제어를 담당하는 저수준 연결 계층이다. 하드웨어 및 외부 인터페이스와의 효율적인 연결 경로를 제공하며, 필요한 경우 직접적인 제어 흐름을 유지할 수 있도록 설계되었다.
    • Borrow Model The Borrow Model is a data access model designed to share information between modules without transferring ownership. When a module requires data from another module, the data is accessed through a dereferenced pointer registered in the Pipeline Context. Ownership remains with the original module, while pointer validity is guaranteed by the lifetime of the associated Context.
      • Pipeline Borrow Variables intended for borrowing must be registered within the Pipeline Context and accessed through the registered reference. Direct references to the original Context are prohibited for externally exposed interfaces. 빌림 대상 변수는 Pipeline Context에 등록한 후 등록된 참조를 통해 접근해야 한다. 외부 노출 인터페이스에서는 원본 Context 자체를 직접 참조하는 것을 금지한다.
      • Ownership Borrowing does not transfer ownership. The original module remains responsible for managing the lifetime and modification of the data. 빌림은 소유권을 이전하지 않는다. 원본 데이터를 소유한 모듈이 데이터의 수명과 변경 권한을 계속 관리한다.
      • Access Control Internal services may directly access each other when required, but using the Pipeline Borrow mechanism is recommended to maintain consistent access boundaries and reduce coupling. 내부 서비스 간 연결은 필요한 경우 직접 접근이 가능하지만, 접근 경계 유지와 결합도 감소를 위해 Pipeline Borrow 방식을 사용하는 것을 권장한다.
      Borrow Model은 소유권 이전 없이 모듈 간 데이터를 공유하기 위한 데이터 접근 모델이다. 다른 모듈의 정보가 필요한 경우, Pipeline Context에 빌림 목적의 변수를 등록하고 포인터 역참조(dereferenced pointer)를 통해 접근한다. 데이터의 소유권은 원래 모듈에 유지되며, 포인터의 유효성은 해당 Context의 수명을 통해 보장된다.
      • Pipeline Borrow Variables intended for borrowing must be registered within the Pipeline Context and accessed through the registered reference. Direct references to the original Context are prohibited for externally exposed interfaces. 빌림 대상 변수는 Pipeline Context에 등록 후 역참조하여 사용해야 한다. 외부 노출 인터페이스는 반드시 이 과정을 거쳐야 하며, Context 자체를 직접 참조하는 것은 금지된다.
      • Ownership Borrowing does not transfer ownership. The original module remains responsible for managing the lifetime and modification of the data. 빌림은 소유권을 이전하지 않는다. 원본 데이터를 관리하는 모듈이 데이터의 수명과 변경 권한을 유지한다.
      • Access Control Direct access between internal services is also restricted. When data sharing is required, access must be performed through the Pipeline Borrow mechanism, maintaining consistent data access boundaries and reducing structural coupling between modules. 내부 서비스 간 연결 역시 직접 접근을 제한하며, 데이터 공유가 필요한 경우 Pipeline Borrow 방식을 통해 접근해야 한다. 이를 통해 모든 모듈 간 데이터 접근 경계를 일관되게 유지하고 구조적 결합도를 낮춘다.
    • File split criterion 파일 분할 기준 Responsibility, not LOC. When a namespace exceeds a single role, split into a sub-namespace, File size is a result, not a constraint. LOC 가 아니라 책임이 기준. 네임스페이스가 하나의 역할을 넘으면 서브네임스페이스로 분리. 파일 크기는 결과물이지 제약이 아니기 때문이다.
  3. Context Model 컨텍스트 모델 (Context Model)
    • All states must be managed within a clearly defined ownership scope, either through a context or within the internal scope of a module, while limiting direct global state sharing. 모든 상태(state)는 명확한 소유 범위(scope)를 가진 컨텍스트 또는 모듈 내부에서 관리되어야 하며, 직접적인 전역 상태 공유를 제한한다.
    • Initialization within the context is recommended using C++20 or later. If not possible, direct initialization in main.cpp is permitted. In either case, uninitialized state is not allowed. c++20 이상을 사용하여 컨텍스트 내 초기화 를 추천하며, 불가능시 main.cpp 에서 직접 초기화 한다, 어느 경우든 미초기화 상태는 허용되지 않는다.
    • Variable definitions inside code blocks are prohibited(State -> Context, Temporaries -> Stack). Declarations are only permitted within the context. 코드 내부에서의 변수 정의는 금지(State -> Context, Temporaries -> Stack)되며, 선언은 오직 컨텍스트 안에서만 허용된다.
    • Context lifetime is guaranteed until program termination. If cleanup is required, the owning module handles it. 컨텍스트 수명은 프로그램 종료 시까지 보장된다. 정리가 필요한 경우 해당 모듈이 스스로 처리한다.
    • Multithreading and code reuse topic will be addressed in a separate post. 멀티스레딩과 코드 재사용은 차후 별도의 글에서 다룬다.
    • Keep the no-heap principle for cold data, but select asserts as needed. 콜드 데이터는 힙 없음 원칙은 유지하되 assert는 필요에 따라 선택한다.
    • Hot data context must include the following three static assertions: 핫 데이터 컨텍스트는 다음 세 가지 반드시 포함해야 한다:
      • static_assert(sizeof(Context) <= 64, "Heresy detected: Size overflow"); size must be a multiple of 64, change the value 64 to match your requirement size 는 64의 배수여야 하며 코드의 64는 필요한 수치로 변경 하여 사용 한다.
      • static_assert(std::is_trivially_copyable_v<Context>); proves no heap usage 힙 없음 증명
      • static_assert(std::is_standard_layout_v<Context>); predictable memory layout 메모리 레이아웃 예측 가능
  4. Execution Model 실행 모델 (Execution Model)
    • Separation of execution and implementation parts 실행부/구현부 분리 The implementation and execution parts are separated through function pointers. (The implementation part is encapsulated according to the execution model structure) 실행부와 구현부는 함수 포인터를 통해 분리한다, (실행 모델 구조 를 따르면 구현부는 캡슐화 상태)
    • The implementation part is separated into the ::Impl namespace, and the execution part is called through FPTable. 구현부는 Ex::Impl 네임스페이스로 분리하며, 실행부는 FPTable을 통해 호출된다
    • low-cost Abstraction 저 비용 추상화 FPTable is maintained as an immutable function pointer table after initialization. With stable call patterns, indirect call overhead can be minimized through CPU iBTB (Indirect Branch Target Buffer)-based branch prediction. FPTable은 초기화 이후 변경되지 않는 함수 포인터 테이블로 유지되며, 안정적인 호출 패턴에서는 CPU의 iBTB(Indirect Branch Target Buffer) 기반 간접 분기 예측을 통해 호출 비용이 최소화될 수 있다.
    • no-argument and no-return 무인자, 무반환 no-argument and no-return are the guiding principles.
      무인자(no-argument), 무반환(no-return)을 지향한다.
    • Lambdas 람다 Lambda expressions are permitted, but they must not be used for passing external state or creating dependencies. Lambda는 사용 가능하나, 외부 상태 전달 및 의존성 생성 목적으로 사용하는 것은 제한한다.
    • Self-completeness 자기 완전성 Each module maintains independent ownership by default, even for common code. Sharing is permitted only when there is a clearly justified requirement. 각 모듈은 공통 코드라 하더라도 독립적인 소유를 기본 원칙으로 하며, 공유는 명확한 필요성이 있는 경우에만 허용한다.
    • Function pointer calls can be converted to direct calls via flags during debug builds, making static analysis and debugger tracing easier. 디버그 빌드 시 플래그를 통해 함수 포인터 호출을 직접 호출로 전환할 수 있어, 정적 분석 및 디버거 추적이 용이하다.
  5. Directory Structure 디렉토리 구조 (Directory Structure)
    • The project structure is organized around modules based on responsibility and namespace boundaries, rather than the traditional include(h) / src(cpp) directory separation. 프로젝트 구조는 전통적인 include(h) / src(cpp) 디렉터리 분리 방식이 아닌, 책임과 네임스페이스 기준의 모듈 단위로 구성한다.
    • Always use project-relative paths with <> for includes (EX: <core/ex/main.h>). Use of "" is prohibited. include 경로는 항상 프로젝트 경로 포함 기준 (EX: <core/ex/main.h>) <>를 사용하며 ""는 금지한다.
    • Include placement must follow the execution dependency order. include 배치는 반드시 실행 의존 순서를 따른다.
    • Directory names must be synchronized with namespace names. The folder structure is the architecture document. 디렉토리명은 반드시 네임스페이스명과 동기화한다. 폴더 구조가 곧 아키텍처 문서이다.
    • Do not mix subfolders and files when creating a subnamespace. 서브 네임스페이스 생성 시 서브폴더와 파일을 혼재하지 않는다.
    • Each module directory contains: 각 모듈 디렉토리의 구성:
      File Namespace Scope Architectural Role
      context.h ::Ex::Context State Ownership : Definition of state data structure State Ownership : 상태 데이터 구조 정의
      define.h ::Ex Foundation : Definition of types and constants Foundation : 타입 및 상수 정의
      fptable.h ::Ex::FPTable Execution Model : Function pointer-based execution interface Execution Model : 함수 포인터 기반 실행 인터페이스
      impl.h ::Ex::Impl Declarations : Internal Implementation Declarations : 내부 구현
      impl.cpp ::Ex::Impl Implementation : Business logic, detailed implementation Implementation : 비즈니스 로직 및 세부 구현
      main.h ::Ex Interface : Entry point definition Interface : 엔트리 포인트 정의
      main.cpp ::Ex Ownership : Entry point, ownership, and connection management Ownership : 엔트리 포인트, 소유권, 연결 관리
  6. Allow / Deny 허용 및 제한 목록 (Allow / Deny)
    • Deny:
      • macro - Function-like macros are prohibited unless they satisfy all of the following conditions:
        • It must not be expressible using constexpr.
        • It must be used solely for compile-time constant composition.
        • It must not contain any runtime logic.
        macro - 다음 조건을 모두 만족하지 않는 함수형 매크로는 금지한다:
        • constexpr 로 표현할 수 없어야 한다.
        • 컴파일 타임 상수 조립 용도여야 한다.
        • 런타임 로직을 포함하지 않아야 한다.
      • template - User-defined template - code expansion and structural complexity template - 사용자 정의 template - 코드 확장 및 구조 복잡도 증가
      • class - class-based internal architecture is restricted; Namespace Ownership Model and Context-based design are preferred class - 내부 아키텍처에서 class 기반 설계를 제한하며, Namespace Ownership Model 및 Context 기반 구조를 우선한다.
      • auto - Explicit type declaration is preferred, and type inference usage is restricted. Exceptions are allowed when required by the C++ language itself, such as storing lambda expressions with anonymous types. auto - 명시적 타입 표현을 우선하며, 타입 추론 목적의 auto 사용을 제한한다. 단, 람다(lambda)의 익명 타입 저장 등 C++ 언어 구조상 필요한 경우는 예외적으로 허용한다.
      • enum - global scope pollution enum - 전역 오염
      • inline - excessive usage is prohibited; only allowed under specific conditions such as performance requirements inline - 남용을 금지하며, 성능 요구 등 명확한 조건에서만 허용한다.
      • variable definition in code - state outside the Context model is prohibited 변수 정의 - Context 외부에서 상태(state)를 관리하는 것을 금지한다.
    • Allow:
      • Lambda expressions - allowed for function object generation, but external state dependency and capture usage are restricted 람다 - 함수 객체 생성을 위해 허용하며, 외부 상태 의존 및 캡처 사용은 제한한다.
      • C++ language features required for external library integration are allowed. However, they must not be applied to the internal architecture model. 외부 라이브러리 대응을 위한 C++ 언어 기능은 허용한다. 단, 내부 아키텍처 구조에는 적용하지 않는다.
  7. Team structure and file access policy 팀 구조 및 파일 접근 권한 (Team Structure)
    • Junior handles implementation only. No knowledge of function pointer structure required. The structure itself prevents mistakes. 구현부만 담당. 함수 포인터 구조를 몰라도 되며, 구조가 실수를 차단한다.
      • impl.cpp, impl.h - read/write (rw)
      • all other files - read only (r)
    • Senior manages module connections and execution model. Responsible for FPTable composition and ownership wiring. 모듈 연결 및 실행 모델 관리. FPTable 구성과 소유권 연결을 담당한다.
      • main.cpp, main.h, fptable.h - read/write (rw)
      • impl.cpp, impl.h - read only (r)
      • all other files - read only (r)
    • Maintainer designs overall namespace structure and enforces rules. Responsible for context design and module boundary decisions. 전체 네임스페이스 구조 설계 및 룰 유지. context 설계와 모듈 경계 결정을 담당한다.
      • all files - read/write (rw)
    • Operations Tips 운영 팁
      • impl_name.cpp clearly identifies the responsible developer. Ownership transfer makes accountability explicit. impl_name.cpp 로 구현 책임자 표시 및 소유권 이양으로 책임 소재 명확화
      • New implementations can be tested by simply swapping FPTable*. Rollback on failure is a one-liner - no git required. FPTable* 교체만으로 새로운 구현 테스트 가능, 오류 시 롤백이 한 줄로 완료 - git 없이도 원복 가능
      • Junior developers can create a personal implementation file such as impl_Smith.cpp and verify it via FPTable swap before merging into the mainstream. Junior 테스트 시 impl_kim.cpp 처럼 개인 구현부를 별도 파일로 작성 후 FPTable 교체로 메인스트림 투입 전 검증 가능.
  8. Before / After Comparison 적용 전 / 후 비교
    • Before this model was established, modifying a single function often required tracking 5~6 related files due to hidden dependencies between classes. The actual fix took minutes, but finding where to fix took a long time. 본 모델 정립 이전에는 하나의 함수를 수정하면 클래스 간 숨겨진 의존성으로 인해 5~6개의 연관 파일을 추적해야 했다. 실제 수정은 몇 분이지만 어디를 수정해야 하는지 찾는 데 긴 시간이 소요되었다.
    • After applying C++ Redefine, the file boundary is the access boundary. Modifications are structurally contained within the owning module. There is no need to trace hidden dependencies. C++ Redefine 적용 후에는 파일 경계가 곧 접근 경계이므로 수정 범위가 소유 모듈 내에서 구조적으로 완결된다. 숨겨진 의존성을 추적할 필요가 없다.
    • This model is horizontally scalable, with complexity growing linearly as modules increase. This has been validated through standalone maintenance of 40,000 LOC. 이 모델은 수평적 확장이 가능하며, 모듈이 늘어나도 복잡도가 선형으로 증가한다. 40,000 LOC 의 단독 유지로 이를 검증하였다.
    • This is not merely a claim - it is the direct experience that forced a complete redesign of the project that later became Smeltrix. 이는 단순 주장이 아니라 Smeltrix 의 전면 재설계를 했던 직접적인 경험이다.
    • Smeltrix:
      • 0.0.5: As the codebase grew, the limitations of the traditional structure were anticipated, and a full redesign was decided upon. 0.0.5: 작성 코드의 증가로 인하여 기존 전통적 구조의 한계를 예측, 전면 재설계를 결심하였다.
      • 0.0.6: Through iterative code revision, the C++ Redefine model was established. 0.0.6: 지속적인 코드 수정을 통해 C++ Redefine 모델을 정립하였다.
      • The existing code was based on conventional class and parameter patterns, and was rewritten in its entirety. 기존 코드는 일반적인 class, 인자 방식이였고 전부 다시 작성하였다.
      • This process did not happen all at once. It was carried out incrementally - restructuring, replacing classes, eliminating parameters, converting variables to contexts, and introducing function pointer tables - while simultaneously adding new features and maintaining temporary compatibility with the existing code. As a result, the actual codebase at the time of 0.0.6 exceeded 40K LOC, including deleted code. 이 과정은 단번에 이루어지지 않았으며, 구조 변경, 클래스 교체, 인자 제거, 변수 ->컨텍스트화, 함수 포인터 테이블 도입 등 점진적으로 이뤄졌으며, 동시에 기능 추가 및 기존 코드 임시 호환성 작업을 같이 진행하였기 때문에 0.0.6 당시 실제 코드량은 삭제 코드 포함 40K LOC 를 넘어갔다.
      • Following the establishment of the model, maintenance costs decreased and development velocity increased dramatically. This is not merely a claim - it is a change confirmed through actual development records and results. 모델 정립 이후 관리 비용 저하 및 개발 속도의 비약적 증가가 이루어졌다. 이는 단순한 주장이 아니라, 실제 개발 과정에서 축적된 개발 기록과 결과를 통해 확인된 변화이다.
  9. The following content will be covered in a separate post 다음 내용은 별도의 게시물에서 진행 예정
    • Code Reuse 코드 재사용
    • External API Integration 외부 API 연동
    • Pipelines 파이프라인
    • Multithreading 멀티스레딩
    • Function Pointer 함수 포인터
    • Other details 기타 세부 사항
  10. Conclusion 결론
    • C++ Redefine is not an extension of the C++ language itself, but a structural architecture model designed to control complexity through system design. By introducing the Namespace Ownership Model, Context-based state management, and Pipeline-based access structure, this model aims to structurally address common issues in large-scale C++ systems, including unclear ownership, increasing dependencies, and unmanaged state. The model preserves existing C++ ecosystems and legacy assets without requiring a language transition, while providing a system architecture with clear ownership boundaries and controlled execution flows. Existing C++ developers can continue utilizing their accumulated code assets and tools, while new developers can apply consistent system design principles through explicit structural rules. C++ Redefine은 C++ 언어 자체의 기능 확장이 아닌, 구조적 설계를 통해 복잡성을 제어하는 아키텍처 모델이다. Namespace Ownership Model, Context 기반 상태 관리, Pipeline 기반 접근 구조를 통해 기존 C++ 시스템에서 발생하는 소유권 불명확, 의존성 증가, 상태 관리 문제를 구조적으로 해결하는 것을 목표로 한다. 본 모델은 새로운 언어로의 전환 없이 기존 C++ 생태계와 레거시 자산을 유지하면서, 명확한 소유권 경계와 제어 흐름을 갖는 시스템 아키텍처를 제공한다. 기존 C++ 개발자는 축적된 코드 자산과 도구를 그대로 활용할 수 있으며, 새로운 개발자는 명확한 구조 규칙을 기반으로 일관된 시스템 설계 방식을 적용할 수 있다.

FAQ

  1. Q: Aren't these all existing techniques?

    A famous chili restaurant didn't invent chili peppers.

    Q: 이미 기존에 다 존재하는 기법들이다.

    소문난 김치찌개 식당도 김치를 발명하진 않았다.

  2. Q: Incomplete?

    A: The complete structure will not be covered in this document, A complete Redefine can only be achieved when combined with subsequent documents.

    Q: 미완성?

    A: Redefine의 전체 구현을 이번 문서에서는 다루지 않는다. 이후 내용들과 합쳐야만 Redefine을 구성할 수 있다.

  3. Q: C++ -> C conversion?
    • Design with C++ (Define)
    • Refine to the purity of C (Refine)
    • A complete state that runs in any environment (Fine)

    A: Namespaces are mapped 1:1 to C-style prefixes (Ex::Impl::DoSomething → Ex_Impl_DoSomething), POD Context structures maintain the same memory layout as C structures, and FPTable itself is a C-style function pointer structure.

    Q: C++ -> C 변환?
    • C++로 설계(Define)하고
    • C의 순수함으로 정제(Refine)하여
    • 어떤 환경에서도 돌아가는 완전한(Fine) 상태

    A: 네임스페이스는 C 스타일 접두어로 1:1 매핑되고(Ex::Impl::DoSomething -> Ex_Impl_DoSomething), POD 컨텍스트 구조체는 C와 메모리 레이아웃이 동일하며, FPTable은 그 자체로 C 함수 포인터 구조체이다.

  4. Q: Design Philosophy?

    This model pursues a Deterministic Structure. All state is owned by the context, all execution is determined by the FPTable, and external interference is structurally blocked.

    Q: 디자인 철학?

    이 모델은 결정론적 구조(Deterministic Structure)를 지향한다, 모든 상태는 컨텍스트가 소유하고, 모든 실행은 FPTable이 결정하며, 외부 간섭이 구조적으로 차단된다.

  5. Warhammer?

    A: Games Workshop has maintained the Warhammer franchise for over 40 years through consistent lore, clear faction rules, and structured ownership of each domain. C++ Redefine draws the same lesson: A system survives not by adding more, but by maintaining the structure that holds it together. In that sense, GW and software architecture share the same worldview.

    워해머?

    A: Games Workshop은 40년 이상 일관된 세계관, 명확한 파벌 규칙, 각 영역의 구조화된 소유권을 통해 Warhammer 프랜차이즈를 유지해왔다. C++ Redefine은 같은 교훈을 따른다: 시스템은 더 많은 것을 추가함으로써가 아니라, 그것을 하나로 묶는 구조를 유지함으로써 살아남는다. 그런 의미에서 GW와 소프트웨어 아키텍처는 비슷한 세계관을 공유하고 있다.


🍪 Behind the Cut

🍪 비하인드 컷

  • Redefine
  • C
  • C#

© 2026 [http://project-ap.blogspot.com]. All Rights Reserved. This content is exclusive to http://project-ap.blogspot.com. Any unauthorized reproduction, redistribution, or hosting of this material on other platforms is strictly prohibited. Sharing is permitted only via the original URL link.

© 2026 [http://project-ap.blogspot.com]. 모든 권리 보유. 이 콘텐츠는 http://project-ap.blogspot.com에만 독점적으로 제공됩니다. 이 자료를 무단으로 복제, 재배포 또는 다른 플랫폼에 게시하는 것은 엄격히 금지됩니다. 공유는 원본 URL 링크를 통해서만 허용됩니다.

All images in this post are AI-generated unofficial fan creations for non-commercial use. Warhammer 40,000 is a trademark of Games Workshop Ltd. All rights reserved.

이 게시물의 모든 이미지는 비상업적 용도로 사용하기 위해 AI가 생성한 비공식 팬 창작물입니다. Warhammer 40,000은 Games Workshop Ltd.의 상표이며 모든 권리가 보호됩니다.


C++ Redefine template code v0.0.1 (based on c++20)

Note: Copied template code may require adjustment when HTML tags or special characters are interpreted by the environment. 참고: 템플릿 코드 복사 시 환경에 따라 HTML 태그 및 특수 문자가 변환될 수 있음.
  • context.h

    vim - example/context.h
    _ O X
    //================================================================================ // // this code written by http://project-ap.blogspot.com/ // // Copyright (C) 2026 http://project-ap.blogspot.com/ // // This code is released under the MIT License. // Permission is hereby granted, free of charge, to any person obtaining // a copy of this code to use, copy, modify, merge, publish, distribute, // sublicense, and/or sell copies, subject to the above copyright notice // being included in all copies. // // For more information, please visit the blog address above. //================================================================================ #pragma once namespace Ex { struct Context { // Whatever you need int* id = nullptr; int clientid = -1; }; extern Context ctx; } //********************************************** // Uncomment after defining your struct with Hot data // Cold Data doesn't need these. //********************************************** // Waiting for excommunication //static_assert(sizeof(::Ex::Context::YourStruct) <= 64, "Heresy detected: Size overflow"); // required alignas(64) with YourStruct //static_assert(std::is_trivially_copyable_v<::Ex::Context::YourStruct>); //static_assert(std::is_standard_layout_v<::Ex::Context::YourStruct>);
  • define.h

    vim - example/define.h
    _ O X
    #pragma once namespace Ex { static constexpr int USR = 1; }
  • fptable.h

    vim - example/fptable.h
    _ O X
    #pragma once namespace Ex { typedef void (*FnVoidNoArgs)(); struct FPTable { FnVoidNoArgs Init; }; extern FPTable* Current; extern FPTable TDefault; }
  • impl.h

    vim - example/impl.h
    _ O X
    #pragma once namespace Ex::Impl { void DoSomething(); }
  • impl.cpp

    vim - example/impl.cpp
    _ O X
    #include <example/context.h> #include <cstdio> namespace Ex::Impl { void DoSomething() { printf("%d", ctx.clientid); } }
  • main.h

    vim - example/main.h
    _ O X
    #pragma once namespace Ex { void Init(); }
  • main.cpp

    vim - example/main.cpp
    _ O X
    #include <example/context.h> #include <example/define.h> #include <example/fptable.h> #include <example/impl.h> #include <example/main.h> namespace Ex { Context ctx; FPTable FPTDefault = { Impl::DoSomething }; #if defined(YourCondition) FPTable* Current = &FPTDefault; #else //FPTable* Current = Put Your Table; #endif void Init() { // Do Someting Current->Init(); } }

Template code is released under the MIT License. Copyright © http://project-ap.blogspot.com. Permission is hereby granted, free of charge, to any person obtaining a copy of this code to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies, subject to the above copyright notice being included in all copies.

  • awakening.asm
    _ O X
    mov rax, 2 syscall ; [ SYSTEM ] STAGE 1: CANOPTEK UNITS DEPLOYED. ; [ SYSTEM ] LORDS: STILL IN STASIS. .L_TOMB_REPAIR: ; [ SCARAB ] STRUCTURAL DAMAGE DETECTED. ; [ SCARAB ] LIVING METAL RECONSTRUCTION: IN PROGRESS. ; [ SCARAB ] TOMB INTEGRITY: RESTORED. .L_INTRUDER_SCAN: ; [ SPYDER ] SCANNING FOR INTRUDERS... test rcx, rcx jz .L_STAGE1_COMPLETE .L_PURGE: ; [ SPYDER ] INTRUDER DETECTED. NEUTRALIZING. dec rcx jnz .L_PURGE .L_STAGE1_COMPLETE: ; [ STATUS ] TOMB: SECURE. ; [ SYSTEM ] INITIATING STAGE 2. jmp .L_AWAKEN [Press Enter]

Comments