Jump to content

Talk:Code segment

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Sam Tomato (talk | contribs) at 22:08, 12 October 2016 (terminology). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconComputing Stub‑class
WikiProject iconThis article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StubThis article has been rated as Stub-class on Wikipedia's content assessment scale.
???This article has not yet received a rating on the project's importance scale.

Unnamed section

"As a memory region, a code segment may be placed below the heap or stack in order to prevent heap and stack overflows from overwriting it."

Not too sure about the 'below' part. The stack is commonly implemented as 'upside-down' (pushing onto the stack reduces stack pointer register) so it would make more sense to have it in memory that is 'higher' than the stack. — Preceding unsigned comment added by 176.249.187.76 (talk) 13:35, 16 January 2014 (UTC)[reply]

The technique would be ineffective for the heap when memory addresses are decremented. Sam Tomato (talk) 21:59, 12 October 2016 (UTC)[reply]

terminology

Why is the code segment also called the text segment? 118.208.38.118 (talk) 09:33, 12 March 2014 (UTC)[reply]

This article is very confusing. It mixes object files with processor memory and does not make it clear which is which.

To answer the question about code segments and text segments, a code segment is a type of text segment. In object files, the term "text segment" is very misleading; don't try to understand what text segments are based on that name. It would be more accurate to think of a text segment as a general-purpose type of data, of which executable code is one type. For the purpose of link-editing (the program that creates object files) executable code is just data that it does nothing to except copy from input to output. The linker might update addresses within the executable code but that is more commonly done by the operating system during execution. Sam Tomato (talk) 22:08, 12 October 2016 (UTC)[reply]