Team Ai
Apppublic

dwrswr/cpp-module-06-guide

sourceHugging Facemitupdated 1mo agoView on Hugging Face
0likes
App README
Read it live: https://dwrswr-cpp-module-06-guide.static.hf.space Everything below describes the files in this repository.

CPP Module 06 — casts, explained line by line

A single-page guide to the 42 C++ Module 06 project (static_cast, reinterpret_cast, dynamic_cast), written against the code in code/ rather than against the subject in the abstract. Every file of ex00, ex01 and ex02 is shown in full and annotated line by line; every terminal block is pasted from a real run.

Open index.html.

What is inside

sectionwhat you get
00what the module is really testing, and the file map of the project
01the rules that decide the grade before the code is read, each with its cost
02the four casts compared, plus a “which cast do I need?” picker
03ex00 — ScalarConverter line by line, 20 notes, a live converter and a table of the inputs worth knowing
04ex01 — Serializer, the uintptr_t round trip, and the int trap
05ex02 — identify, why Base needs virtual, and a pointer-vs-reference panel
06the Makefile line by line and the commands to type
07leaks and sanitizers, with what was actually verified
08ten ways the module is normally lost
09the correction sheet's own questions answered, plus five live-modification drills
10a pre-defence checklist saved in the browser

Three interactive panels, all hand-written with no dependencies: a ScalarConverter simulator, a `dynamic_cast` lab, and the checklist. There is an EN / العربية switch and a light/dark theme toggle in the top bar.

Verified, not assumed

  • —All three exercises compile with c++ -Wall -Wextra -Werror -std=c++98 (g++ 13.3.0) with zero warnings.
  • —Rebuilt with -fsanitize=address,undefined and run: no leaks, no undefined behaviour.
  • —The in-page converter was diffed against the compiled ./convert on 46 literals and agrees on all 46 — including 2147483647 → float: 2147483648.0f, the pseudo-literals, and every rejection.
  • —A grep across all fourteen source files for printf, alloc, free, using namespace, friend, typeinfo and typeid returns nothing.

The page cannot drift from the code

index.html is generated. tools/build.py reads the real sources out of the project and injects them into tools/index.src.html, so a code block on the page is the file on disk:

bash
python tools/build.py     # rewrites index.html and refreshes code/

Translations are keyed by name in assets/ar.js (data-i18n="s3.m14"), not by position, so adding or reordering a paragraph can never shift a translation onto the wrong element.

Layout

index.html            the guide (generated)
assets/style.css      design system, dark + light
assets/app.js         theme, i18n, C++/Make tokeniser, the three widgets
assets/ar.js          Arabic dictionary, 319 keys
code/cpp06/           the project itself, ex00 / ex01 / ex02
tools/build.py        generator
tools/index.src.html  template