Coroutine in C Language

It’s been quite a while that I haven’t published anything on my blog. But that’s due to the job change. I hope you understand that it has never been easy to re-settle in a new environment with new people while maintaining a steep technical learning curve. It takes time to tune yourself accordingly. Anyways, I wrote on “Coroutine in C Language” as a pre-pend to my upcoming post on C++20 Coroutine....

April 24, 2021 · 11 min · 2254 words · Vishal Chovatiya

How C Program Converts Into Assembly!

In an earlier article, we have seen C runtime: before starting main & How C program stored in RAM memory. Here we will see “How C program converts into assembly?” and different aspect of its working at the machine level. A Bit About Functions Stack Frames During function code execution, a new stack frame is created in stack memory to allow access to function parameters and local variables. The direction of stack frame growth totally depends on compiler ABI which is out of our scope for this article....

September 16, 2019 · 6 min · 1149 words · Vishal Chovatiya

How C Program Stored in Ram Memory!

When you run any C-program, its executable image loaded into RAM of computer in an organized manner which called process address space or memory layout of C program. Here I have tried to show you the same thing in two parts . In the 1st part i.e. “Overview”, we will see segment-wise overview & in 2nd part i.e. “Example”, we’ll see How C program stored in RAM memory? with example....

September 16, 2019 · 9 min · 1715 words · Vishal Chovatiya

Default Handlers in C: weak_alias

Default Handlers in C: weak_alias function tells the linker that new is to be a weak alias for old. That is, this definition of new is a weak symbol. If there is no other definition of a symbol called new, this old definition stands. Might seems alien to you first, so go through a below example & read again. Definition of weak_alias is as follows : 1 2 #define weak_alias(old, new) \ extern __typeof(old) new __attribute__((weak, alias(#old))) If there is another (non-weak) definition of new then that non-weak(i....

September 15, 2019 · 2 min · 256 words · Vishal Chovatiya

How Floating-Point No Is Stored in Memory?

This article is just a simplification of the IEEE 754 standard. Here, we will see how floating-point no stored in memory, floating-point exceptions/rounding, etc. But if you will want to find more authoritative sources then go for What Every Computer Scientist Should Know About Floating-Point Arithmetic https://en.wikipedia.org/wiki/IEEE_754-1985 https://en.wikipedia.org/wiki/Floating_point. Floating-point numbers stored by encoding significand & the exponent (along with a sign bit) Above line contains 2-3 abstract terms & I think you will unable to understand the above line until you read further....

September 15, 2019 · 7 min · 1324 words · Vishal Chovatiya

How Do malloc & free Work in C!

As we know, the process can allocate & deallocate memory using malloc & free in C language. But do you ever consider what happens behind the scene ? or How do malloc & free work? Let see Allocating Memory on the Heap A process can allocate memory by increasing the size of the heap. Heap is a variable-size segment of contiguous virtual memory that begins just after the uninitialized data segment of a process and grows & shrinks as memory allocated and freed....

October 8, 2016 · 5 min · 876 words · Vishal Chovatiya

CRT: C Run Time Before Starting main()

There are a lot of functions called before & after the main execution. As an application developer you need not worry about this stuff, but yes! if you are a core developer who works in Linux kernel, Binutils, compiler or embedded system-related development, then you must know these things. Here in “CRT: C run time before starting main”, we will see some pointers related to it. What Is crt? crt stands for C runtime....

September 10, 2016 · 3 min · 568 words · Vishal Chovatiya