Design Element
Comment on "Intro to Memory and Arrays in C"
by Rico Secada — Jan 06
Well, yes C doesn't officially have a data segment, and it only sort of has a stack. I only know of one C implementation that doesn't (C on LISPM). More importantly because the stack, data segments, type widths, and lots of other "assembler like" things bleed through the abstractions when you look at either performance, or more importantly, bugs.

You are missing the point and you are creating confusion in people who are not skilled in C and who needs to understand these issues right :-)

You should correct the tutorial to conform with standard C and address the issues as automatic storage, static storage and dynamic
storage not as "the data segment" or "the stack". We are not dealing with assembler and this tutorial should not be using those terms regarding C and memory management.

If you know how C's stack works on your CPU finding stack smashing bugs will be far simpler. If you know how your libc's malloc works finding "use after free", or whatever.

Using this sort of knowledge for "good" will help you debug. A whole lot.

This is not within the scope of C. If you need to know exactly how "the stack" works, you need to stop working with C and start working with assembler.

Best regards.

Back to "Intro to Memory and Arrays in C"
Design Element

Copyright © Scott Stevenson 2004-2015