[{"content":" Advanced English Get Started Final Course\u0026rsquo;s Project # By the end of this course, we will build a small BMP image editor that ties together preprocessing, memory management, structures/unions, and file I/O — a practical portfolio piece. Excited ? follow below .. \u0026#x1f447;\nCourse Description Already comfortable with C basics? Go under the hood. Join 3000+ happy students who rated the course at 4.65/5. In 8 focused hours, you’ll master pointers, memory layout, compiler behavior, and system-level concepts — with hands-on projects that make them easier to digest. This course is concise by design: no filler, no wasted time, no detours into beginner topics — just the knowledge you need to write better C code immediately. What you\u0026#39;ll learn How the C preprocessor works and how to debug/preprocess code using compiler flags. The function execution model: stack layout, argument passing, and local variable handling. Pointers and dynamic memory: how pointers map to memory, common pitfalls, and safe usage. Implementing a small dynamic memory manager to understand allocation mechanics. Structures and unions with real-world examples. Modular design principles to create reusable C code. A hands-on project: building a BMP image editor to combine the concepts. Course approach \u0026amp; highlights Efficient: No fillers, no lengthy videos to pad content: only content to the point Root-cause explanations: we don’t just show code; we explain why it behaves that way. Real-life examples: no toy problems, examples modeled after real systems and tooling. Hands-on projects: apply concepts immediately (including a BMP editor). Practical tool usage: compiler flags, debugging tips, and techniques you’ll use in production. Prerequisites Basic familiarity with C (variables, loops, functions). A C compiler (GCC/Clang) and a terminal or IDE. Nothing more advanced is required. Get Started ","date":"1 October 2025","externalUrl":null,"permalink":"/courses/advanced-c-programming/","section":"Courses","summary":"Deep dive into pointers, memory, C internals, and hands-on projects","title":"Advanced C Programming","type":"courses"},{"content":" Just stay tuned \u0026hellip; # ","date":"1 January 2026","externalUrl":null,"permalink":"/courses/coming-soon/","section":"Courses","summary":"A nice system programming course in being baked …","title":"Coming Soon","type":"courses"},{"content":"","date":"1 January 2026","externalUrl":null,"permalink":"/courses/","section":"Courses","summary":"","title":"Courses","type":"courses"},{"content":" See Testimonials on LinkedIn Hi, I am an Embedded Software Consultant with 13+ years of experience in C/C++ development for bare-metal and RTOS-based systems, covering firmware and embedded applications across multiple engineering-driven industries. Enjoy reading my blog posts, have a look at my courses, and feel free to connect, it is my pleasure! ","date":"1 January 2026","externalUrl":null,"permalink":"/","section":"Home","summary":"","title":"Home","type":"page"},{"content":"","date":"8 December 2025","externalUrl":null,"permalink":"/blog/","section":"Blog","summary":"","title":"Blog","type":"blog"},{"content":"","date":"8 December 2025","externalUrl":null,"permalink":"/tags/c++/","section":"Tags","summary":"","title":"C++","type":"tags"},{"content":"As C++ developers, we often use overloaded functions when we have different logic to handle different types of data, so we write a separate implementation per type. The down-side of this approach is that we don’t have a fallback implementation that applies as a default to the types for which we don’t have implementation.\nvoid foo (int x) { std::cout \u0026lt;\u0026lt; \u0026#34;int implementation\u0026#34; \u0026lt;\u0026lt; std::endl; } void foo(float x) { std:: cout \u0026lt;\u0026lt; \u0026#34;float implementation\u0026#34; \u0026lt;\u0026lt; std::endl; } foo(\u0026#34;hello\u0026#34;); // fails - no implementation for std::string That’s why we have template functions. Templates are used when we have the same logic to handle different types of data. If we need to handle all the types with the same logic, except a few types that must be handled with a different logic, then we use template specialization.\ntemplate \u0026lt;typename T\u0026gt; void foo(T x) { std:: cout \u0026lt;\u0026lt; \u0026#34;primary template implementation\u0026#34; \u0026lt;\u0026lt; std::endl; } template void foo(std:: string x) { std:: cout \u0026lt;\u0026lt; \u0026#34;template specialization for std::string\u0026#34; \u0026lt;\u0026lt; std::endl; } foo(2); // primary template implementation foo(\u0026#34;hello\u0026#34;); // template specialization for std:: string foo(instance_of_some_object); // primary template implementation However, when we start mixing overloaded functions with template specialization, things start to become blurry.\nI’ll give the example below, think of it, then I will tell you the rules the compiler uses to decide if it is going to pick up the non-template overload function, the primary template or the specialized template:\n#include \u0026lt;iostream\u0026gt; #include \u0026lt;string\u0026gt; typedef const char* MyStr; void foo( int x) { std::cout \u0026lt;\u0026lt; \u0026#34;non-template int\u0026#34; \u0026lt;\u0026lt; std::endl; } void foo(double x) { std::cout \u0026lt;\u0026lt; \u0026#34;non-template double\u0026#34; \u0026lt;\u0026lt; std::endl; } template \u0026lt;typename T\u0026gt; void foo(T t) { std::cout \u0026lt;\u0026lt; \u0026lt;\u0026lt; \u0026#34;primary template\u0026#34; \u0026lt;\u0026lt; std::endl; } template void foo(const char* t) { std:: cout \u0026lt;\u0026lt; \u0026#34;specialized const char*\u0026#34; \u0026lt;\u0026lt; std::endl; } int main() { int i = 42; float f = 3.14f; double d = 2.718; MyStr s = \u0026#34;hello\u0026#34;; const char* cs = \u0026#34;world\u0026#34;; const float cf = 1.23f; MyStr* ps = \u0026amp;s; // Part 1: Standard cases foo(i); // ? foo(f); // ? foo(d); // ? foo(s); // ? foo(cs); // ? // Part 2: Extra tricky cases foo(cf); // ? foo(ps); // ? } Let’s see how does the compiler choose which function to use in our example:\nThe compiler lists all the viable candidate functions (all non-template overloaded + primary templates. Template specializations are totally ignored in this stage). If a non-template function with exactly the same type is found without type conversion, the compiler chooses it. Even if there is an exact match with template specialization. As we said, specialization is not considered at this stage. If not found, the compiler considers the template function: If there is a template specialization with exactly the same types (no conversion), the template specialization is called. Otherwise, the primary template is used. If there are no template functions, the compiler chooses the non-template overload with type promotion (which is an automatic type conversion that the compiler does, like char -\u0026gt; int, float -\u0026gt; double). If there are no non-template overload with type promotion, the compiler chooses a non-template overload with standard type conversion (like float -\u0026gt; int). If there is no such non-template with standard conversion, the compiler chooses a non-template with user defined conversion (like converting char * to std::string) If no such function, it is time to raise an error. This means that: # Exact matching non-template beats exact-matching template specialization. Exact matching template specialization beats primary template. Primary template beats non-template overload with type promotion. Non-template overload with type promotion beats non-template overload with standard conversion. It is also very important to know that: # Template specializations are never competing with overload resolution. Template specializations are selected only and only if they have an exact match. They are never selected with conversion. Template specialization always follow a primary template. Specialization without a primary template is not possible. Non-template overloads may be selected for implicit or standard conversion (if no exact match with non-template, and there is no template) Template specializations are only considered if type deduction of their their primary template is done, then the compiler checks if there is a better special implementation with T=type_in_question. Applying these rules to the example: # foo(i) -\u0026gt; Exact type match with non-template -\u0026gt; non-template int. foo(f) -\u0026gt; Non-template foo(double) could match, but involves type promotion, so the compiler considers template. There’s no template specialization with double -\u0026gt; primary template. foo(d) -\u0026gt; Same logic as foo(i) -\u0026gt; non-template double. foo(s) and foo(cs) -\u0026gt; MyStr is typedefded to const char*, so they’re treated the same. No exact non-template, so the compiler goes to template. There’s an exact match template specialization -\u0026gt; specialized const char*. foo(cf) and foo(ps) -\u0026gt; Same logic as foo(f), no non-template exact match, check template, no exact match template specialization -\u0026gt; primary template. ","date":"8 December 2025","externalUrl":null,"permalink":"/blog/mixing-cpp-template-with-overloads/","section":"Blog","summary":"","title":"Mixing C++ Template Specialization with Non-template Overloads - Who Wins ?","type":"blog"},{"content":"","date":"8 December 2025","externalUrl":null,"permalink":"/tags/programming-languages/","section":"Tags","summary":"","title":"Programming Languages","type":"tags"},{"content":"","date":"8 December 2025","externalUrl":null,"permalink":"/tags/","section":"Tags","summary":"","title":"Tags","type":"tags"},{"content":" Send me a message Name Email Subject Message Send Message ","externalUrl":null,"permalink":"/contact/","section":"","summary":"","title":"","type":"contact"},{"content":" Nice to meet you Hi, I'm Ahmed Adel Embedded Software Consultant\nI’m an Embedded Software Engineer with 13+ years of experience designing and delivering reliable, production-grade C/C++ firmware and applications — from bare-metal systems to RTOS-based platforms (FreeRTOS, Zephyr) — across automotive, IoT, and industrial domains. I specialize in building robust embedded software that ships, scales, and lasts, drawing on deep hands-on expertise with microcontrollers, microprocessors, operating systems, and complex system integration. Through this site, I share practical, real-world insights on embedded software engineering via technical blog posts, and I offer online courses focused on building solid, industry-ready skills. I’m always open to connecting with fellow engineers, technical leaders, and teams working on challenging embedded systems. Feel free to reach out. Core Expertise C/C++ Python freeRTOS ZephyrRTOS Bluetooth Low Energy Requirements Engineering Let's Work Together ","externalUrl":null,"permalink":"/about/","section":"About Me","summary":"","title":"About Me","type":"about"},{"content":"","externalUrl":null,"permalink":"/authors/","section":"Authors","summary":"","title":"Authors","type":"authors"},{"content":"Here is a chronological look at my professional journey, key milestones, and transitions.\nASML Aug 2021 - Present Senior Software Engineer Contributing to the software powering ASML's EUV lithography systems, among the world's most advanced semiconductor manufacturing machines. Working within a highly complex 50M+ line codebase and multi-diciplinary team, developing software that helps enable the production of next-generation computer chips. Si-Vision Aug 2018 - Aug 2021 Senior Embedded Software Team Leader Led a team of 5 embedded software engineers developing demonstrations for next-generation Bluetooth Low Energy technologies, including features such as audio streaming over BLE and BLE/IEEE 802.15 coexistence. Worked closely with firmware, radio teams, as well as contributing to open source BLE host stack to showcase new capabilities to customers and partners. Technical ownership, technical mentoring, code and design reviews, interviewing new hires, conducting induction training, execute annual appraisal interviews, as well as managing the project's progress have been always among my respobibilities. Si-Vision Jan 2017 - Aug 2018 Senior Embedded Software Engineer Worked on the design and implementation of the Bluetooth Low Energy (BLE 4.2/5.0) Link Layer, developing embedded software for timing-sensitive wireless communication features and protocol behavior. Valeo May 2012 - Jan 2017 Embedded Software Engineer Developed the embedded software for Valeo's 360Vue surround-view camera system, contributing to advanced driver assistance (ADAS) solutions deployed by automotive manufacturers including BMW, Mercedes-Benz, Audi, Volkswagen and Jaguar Land Rover. ","externalUrl":null,"permalink":"/career/","section":"Career Milestones","summary":"","title":"Career Milestones","type":"career"},{"content":"","externalUrl":null,"permalink":"/categories/","section":"Categories","summary":"","title":"Categories","type":"categories"},{"content":"","externalUrl":null,"permalink":"/series/","section":"Series","summary":"","title":"Series","type":"series"}]