Skip to content

Instantly share code, notes, and snippets.

View MangaD's full-sized avatar
📚
studying

David Gonçalves MangaD

📚
studying
View GitHub Profile
@MangaD
MangaD / cpp_copy_move_operations_base_and_derived_classes.md
Created September 16, 2025 11:27
Handling Copy and Move Operations in C++ Derived Classes

Handling Copy and Move Operations in C++ Derived Classes

CC0

Disclaimer: Grok generated document.

In C++, when a derived class defines its own copy and move constructors or assignment operators, it must explicitly handle the copy or move operations of the base class portion of the object to ensure proper initialization and resource management. This article explains how to correctly implement these operations in a derived class when the base class has user-defined copy and move constructors or operators.

Key Principles

  1. Base Class Initialization: The derived class must explicitly call the base class’s copy or move constructor in the member initializer list of its own copy or move constructor.
@MangaD
MangaD / cpp_virtual_calls_in_destructor.md
Created September 15, 2025 20:54
Why Virtual Method Calls in C++ Destructors Are Resolved at Compile Time

Why Virtual Method Calls in C++ Destructors Are Resolved at Compile Time

CC0

Disclaimer: Grok generated document.

In C++, calls to virtual methods from within a destructor (or constructor) are resolved statically at compile time to the version defined in the class whose destructor is currently executing, rather than dynamically at runtime to the most derived class's overriding version. This behavior is a deliberate design choice in the language standard to ensure safety and predictability during object destruction, as explained below.

The Mechanics of Object Destruction

C++ objects with inheritance are constructed and destroyed in a specific order:

@MangaD
MangaD / bootloader.md
Last active September 14, 2025 15:20
Bootloader

Bootloader

CC0

Disclaimer: Grok generated document.

What is a Bootloader?

A bootloader (also known as a boot loader, bootstrap loader, or boot manager) is a small computer program that plays a crucial role in starting up a device by loading the operating system (OS) into the computer's random-access memory (RAM). When a device powers on, it doesn't have an OS running yet—the bootloader bridges the gap between the initial hardware state and the full OS environment. It initializes essential hardware components (like the CPU, memory, and storage), locates the OS kernel (the core of the OS), loads it into RAM, and transfers control to it so the OS can take over and initialize further drivers and user interfaces.

@MangaD
MangaD / drivers.md
Created September 14, 2025 14:37
Drivers

Drivers

CC0

Disclaimer: Grok generated document.

In computers, drivers are specialized software components that act as intermediaries between a computer's operating system (OS) and hardware devices. They enable the OS to communicate with and control hardware, such as graphics cards, printers, keyboards, or network adapters, by translating OS commands into instructions the hardware understands.

What Are Drivers?

  • Function: Drivers provide a standardized interface for the OS to interact with hardware, handling tasks like sending data to a printer, rendering graphics, or reading input from a mouse. Without drivers, the OS wouldn't know how to manage specific hardware, as each device has unique protocols.
@MangaD
MangaD / ecu.md
Created September 12, 2025 23:06
Introduction to Electronic Control Units (ECUs)

Introduction to Electronic Control Units (ECUs)

CC0

Disclaimer: Grok generated document.

An Electronic Control Unit (ECU), also known as an Electronic Control Module (ECM), is an embedded system primarily used in automotive electronics to control one or more electrical systems or subsystems in a vehicle. It acts as the "brain" of various vehicle components, processing data from sensors and making real-time adjustments to ensure optimal performance. ECUs are essentially small computers that manage everything from engine operations to safety features, using digitally stored equations, numeric tables, and algorithms to regulate outputs. While most commonly associated with cars, trucks, and other motor vehicles, similar control units can be found in other applications like industrial machinery, aviation, and even some consumer electronics, though automotive use dominates the discussion.

History

@MangaD
MangaD / HyperV.md
Created September 12, 2025 22:55
Hyper-V: Microsoft's Native Hypervisor

Hyper-V: Microsoft's Native Hypervisor

CC0

Disclaimer: Grok generated document.

Hyper-V is Microsoft's hardware virtualization platform, functioning as a type-1 hypervisor that runs directly on the host hardware to create and manage virtual machines (VMs). It allows multiple operating systems to run simultaneously on a single physical server, isolating workloads for efficiency, security, and resource optimization. Originally codenamed "Viridian," it has evolved into a core component of Microsoft's ecosystem, particularly for enterprise environments, hybrid cloud setups, and development/testing scenarios.

History and Versions

Hyper-V's development began in the mid-2000s, with a beta release included in certain x86-64 editions of Windows Server 2008. The full version launched on June 26, 2008, via Windows Update, replacing older tools like Microsoft Virtual Server. It became a standard featur

@MangaD
MangaD / composition_over_inheritance.md
Created September 12, 2025 14:04
Composition Over Inheritance

Composition Over Inheritance

CC0

Disclaimer: Grok generated document.

In software development, particularly within object-oriented programming (OOP), "composition over inheritance" is a design principle that recommends favoring composition—building classes by combining instances of other classes—to achieve code reuse and polymorphism, rather than relying on inheritance—where one class derives from another (a parent or base class). This approach promotes more flexible, maintainable, and testable code by modeling "has-a" relationships instead of forcing "is-a" relationships.

Key Concepts: Inheritance vs. Composition

To understand the principle, let's break down the two approaches:

@MangaD
MangaD / cpp_vs_rust.md
Created September 11, 2025 18:16
C++ vs Rust

C++ vs Rust

CC0

Disclaimer: Grok generated document.

Introduction

C++ and Rust are both powerful systems programming languages designed for performance-critical applications. C++ evolved from C in the 1980s, adding object-oriented features and becoming a staple for complex software like operating systems and games. Rust, developed by Mozilla and first released in 2015, prioritizes memory safety, concurrency, and reliability without sacrificing speed. While C++ offers flexibility and a mature ecosystem, Rust aims to prevent common bugs at compile time. This comparison draws from various analyses to highlight their differences across syntax, features, and applications.

@MangaD
MangaD / paxos.md
Last active September 10, 2025 21:12
Paxos

Paxos

CC0

Disclaimer: Grok generated document.

Introduction to Paxos

Paxos is a family of protocols designed to achieve consensus in distributed systems where nodes (computers or processes) may fail, crash, or experience network issues. Consensus means that all non-faulty nodes agree on a single value or decision, even if some nodes propose different values or fail during the process. This is crucial for building fault-tolerant systems, such as replicated databases or configuration services, where consistency across nodes is essential. Paxos ensures safety (e.g., no conflicting decisions) under asynchronous conditions but does not guarantee liveness (progress) in all scenarios due to fundamental limits in distributed computing, like the FLP impossibility theorem. It is often used as the foundation for state machine replication, where a sequence of commands is applied consistently across replic

@MangaD
MangaD / master_slave.md
Created September 8, 2025 22:04
Introduction to Master-Slave Architecture in Software Engineering

Introduction to Master-Slave Architecture in Software Engineering

CC0

Disclaimer: Grok generated document.

Master-slave architecture, also known as master-slave pattern or model, is a fundamental design paradigm in software engineering and computing where a central component (the "master") controls, coordinates, and directs one or more subordinate components (the "slaves"). The master typically handles decision-making, task distribution, and overall system management, while slaves execute assigned tasks and report back. This architecture is prevalent in distributed systems, databases, and hardware-software interfaces to achieve scalability, redundancy, and load balancing. However, the terminology has faced significant criticism for its historical connotations related to slavery, leading to widespread deprecation in favor of more neutral terms like primary-replica, leader-follower, or controller-w