{"id":26078224,"url":"https://github.com/jos-felipe/cpp-module-06","last_synced_at":"2025-10-07T20:35:54.494Z","repository":{"id":277022197,"uuid":"930960641","full_name":"jos-felipe/cpp-module-06","owner":"jos-felipe","description":"This module is designed to help you understand the different casts in CPP.","archived":false,"fork":false,"pushed_at":"2025-02-13T14:47:36.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T03:51:17.474Z","etag":null,"topics":["imperative-programming","object-oriented-programming","rigor"],"latest_commit_sha":null,"homepage":"https://projects.intra.42.fr/projects/cpp-module-06","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jos-felipe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-11T13:53:34.000Z","updated_at":"2025-02-13T14:47:39.000Z","dependencies_parsed_at":"2025-02-11T18:44:49.242Z","dependency_job_id":null,"html_url":"https://github.com/jos-felipe/cpp-module-06","commit_stats":null,"previous_names":["jos-felipe/cpp-module-06"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jos-felipe/cpp-module-06","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jos-felipe%2Fcpp-module-06","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jos-felipe%2Fcpp-module-06/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jos-felipe%2Fcpp-module-06/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jos-felipe%2Fcpp-module-06/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jos-felipe","download_url":"https://codeload.github.com/jos-felipe/cpp-module-06/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jos-felipe%2Fcpp-module-06/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278841586,"owners_count":26055377,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["imperative-programming","object-oriented-programming","rigor"],"created_at":"2025-03-09T03:50:24.557Z","updated_at":"2025-10-07T20:35:54.475Z","avatar_url":"https://github.com/jos-felipe.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# C++ Module 06 - Type Casting\n\nThis module explores the various type casting mechanisms available in C++98, focusing on their proper usage, safety features, and specific use cases. Understanding type casting is crucial for managing data type conversions and ensuring type safety in C++ programs.\n\n## Overview\n\nType casting in C++ provides several mechanisms to convert data between different types:\n\n1. **Static Cast (`static_cast`)**: The most straightforward casting mechanism, used for conversions between related types (like int to float, or up/down a class hierarchy).\n\n2. **Reinterpret Cast (`reinterpret_cast`)**: Used for low-level reinterpreting of bit patterns, typically for converting between pointer types. This is the most dangerous form of casting.\n\n3. **Dynamic Cast (`dynamic_cast`)**: Used for safe downcasting in inheritance hierarchies, with runtime type checking.\n\n4. **Const Cast (`const_cast`)**: Used to remove or add const qualification from variables.\n\n## Module Exercises\n\n### Exercise 00: Scalar Type Conversion\n- Implementation of a `ScalarConverter` class\n- Static method for converting between fundamental data types\n- Handling of special cases (inf, nan)\n- Focus on proper type detection and conversion\n\n### Exercise 01: Serialization\n- Implementation of a `Serializer` class\n- Converting pointers to integers and back\n- Understanding memory representation\n- Safe pointer handling\n\n### Exercise 02: Real Type Identification\n- Runtime type identification without RTTI\n- Implementation of base and derived classes\n- Dynamic type checking\n- Pointer vs Reference behavior\n\n## Technical Requirements\n\n- Compile with C++98 standard\n- Compile flags: `-Wall -Wextra -Werror`\n- Each exercise must include a Makefile with the following rules:\n  - `all`: Builds the program\n  - `clean`: Removes object files\n  - `fclean`: Removes object files and executable\n  - `re`: Rebuilds the program\n\n## Code Style Guidelines\n\n- Follow Orthodox Canonical Class Form\n- Proper header guards\n- No using namespace declarations\n- No external libraries except the Standard Library\n- Memory leak-free code\n\n## Learning Objectives\n\nUpon completing this module, students will understand:\n- The differences between C++ casting operators\n- When to use each type of cast\n- Type safety in C++\n- Runtime type identification techniques\n- Proper memory handling with pointers\n- Serialization concepts\n\n## Testing\n\nEach exercise includes specific test cases to verify proper implementation. Students should:\n- Test edge cases\n- Verify proper memory management\n- Ensure type safety\n- Handle error cases gracefully\n\n## References\n\n- C++98 Standard Documentation\n- Stroustrup, Bjarne. \"The C++ Programming Language\"\n- School 42 Coding Standards\n\n## Author\n\nThis module is part of the C++ modules created by School 42.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjos-felipe%2Fcpp-module-06","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjos-felipe%2Fcpp-module-06","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjos-felipe%2Fcpp-module-06/lists"}