Skip to content

docs: expand Chapter 12 C/C++ Compatibility to C++26 - #19

Open
yuchdev wants to merge 6 commits into
masterfrom
docs/ch12-c-cpp-compat-cpp98-cpp26
Open

yuchdev wants to merge 6 commits into
masterfrom
docs/ch12-c-cpp-compat-cpp98-cpp26

Conversation

@yuchdev

@yuchdev yuchdev commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Reviewed the six mixed C/C++ example groups and expanded language-vs-ABI differences, C linkage, callbacks, allocation, structs, type qualifiers, C99 VLAs/restrict, C11 atomics, C23 vs C++23, C++20 modules and C++26 reflection. Updated numbered Markdown chapter structure for chapter validator in PR #15. README-only, C++20 build baseline unchanged.

Copilot AI balanced review requested due to automatic review settings October 18, 2026 17:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The documentation-only changes leave two minor precision corrections, with no blocking issues.

2 open issues
What changed in this PR

Expands Chapter 12’s C/C++ interoperability guidance through C++26 while preserving the C++20 build baseline.

Changes:

  • Explains ABI boundaries, ownership, callbacks, and language differences.
  • Adds guidance on modules, reflection, and production interfaces.
  • Numbers body sections for chapter-validator compatibility.
File Description
01_low_level/​12_c_cpp/​README.md Expands interoperability explanations and updates chapter structure.

Review effort: Balanced


### Function pointers and callbacks need a deliberate lifetime protocol

A C callback typically consists of a function pointer plus a context pointer. A capturing C++ lambda cannot implicitly become a C function pointer; a noncapturing lambda can convert to a pointer to function with appropriate language linkage behavior as specified, but binary interfaces still require a compatible function-pointer contract.

### C99 VLAs and compound literals are not ordinary C++ syntax

A C variable-length array has runtime size and stack-storage semantics; standard C++ does not provide C99 VLAs. Some GCC and Clang C++ modes accept them as extensions, which can accidentally turn portable-looking code into vendor-specific code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants