473,802 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Segment

Can anyone please tell me what are the different segments in a C
program? Where can I find more details regarding this?

Please help.

Merry Christmas and Happy New Year

Regards,
Raghu

Dec 28 '06 #1
8 3475
In article <11************ **********@42g2 000cwt.googlegr oups.com>,
raghu <ra*********@gm ail.comwrote:
>Can anyone please tell me what are the different segments in a C
program? Where can I find more details regarding this?
The C standard says nothing about "segments" for C programs.
Anything having to do with "segments" is system-specific, and
you need to read the documentation for your system.

See also
http://groups.google.ca/group/comp.l...2eceed7a419316
--
All is vanity. -- Ecclesiastes
Dec 28 '06 #2
"raghu" <ra*********@gm ail.comwrote in message
news:11******** **************@ 42g2000cwt.goog legroups.com...
Can anyone please tell me what are the different segments in a C
program? Where can I find more details regarding this?
You may find this page interesting reading:

http://www.ualberta.ca/CNS/RESEARCH/...sters/mem.html

"Segment" is a very system-specific notion. Some systems historically have
had shared "segments" optimized linking, loading, running common programs,
etc. in various ways.

Some systems historically have also had hardware limitations on the amount
of memory that could be in a segment, leading to various ways of linking and
loading large programs.

http://en.wikipedia.org/wiki/Memory_segment

Generally, any small 'C' program is going to have at minimum a)executable
code, b)stack, and c)memory for static and global variables.

Understanding the ELF format is a good first step.

Dec 28 '06 #3
raghu said:
Can anyone please tell me what are the different segments in a C
program?
The term is not used within the C language specification. We have functions,
if that's any help to you.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Dec 28 '06 #4
In article <BL************ *********@bt.co m>,
Richard Heathfield <rj*@see.sig.in validwrote:
>raghu said:
>Can anyone please tell me what are the different segments in a C
program?
>The term is not used within the C language specification. We have functions,
if that's any help to you.
I note the local man pages use the term in at least one place:

strspn (or strcspn) returns the length of the initial segment of string
s1 which consists entirely of characters from (not from) string s2.

I don't have my Standard available to check the official wording.
--
I was very young in those days, but I was also rather dim.
-- Christopher Priest
Dec 28 '06 #5
Walter Roberson said:
In article <BL************ *********@bt.co m>,
Richard Heathfield <rj*@see.sig.in validwrote:
>>raghu said:
>>Can anyone please tell me what are the different segments in a C
program?
>>The term is not used within the C language specification. We have
functions, if that's any help to you.

I note the local man pages use the term in at least one place:

strspn (or strcspn) returns the length of the initial segment of
string s1 which consists entirely of characters from (not from)
string s2.

I don't have my Standard available to check the official wording.
I am guilty of jumping to a conclusion. The Standard does indeed use the
term 'segment' in the docs for strcspn and strspn, to refer to the first
part of a string.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Dec 28 '06 #6
"Richard Heathfield" <rj*@see.sig.in validwrote in message
news:c7******** *************@b t.com...
Walter Roberson said:
>In article <BL************ *********@bt.co m>,
Richard Heathfield <rj*@see.sig.in validwrote:
>>>raghu said:
>>>Can anyone please tell me what are the different segments in a C
program?
>>>The term is not used within the C language specification. We have
functions, if that's any help to you.

I note the local man pages use the term in at least one place:

strspn (or strcspn) returns the length of the initial segment of
string s1 which consists entirely of characters from (not from)
string s2.

I don't have my Standard available to check the official wording.

I am guilty of jumping to a conclusion. The Standard does indeed use the
term 'segment' in the docs for strcspn and strspn, to refer to the first
part of a string.
Ah ... actually, you were right the first time. The term as the OP intended
is not really used.

It depends on whether you interpret "term" to be (the literal word) or (a
particular meaning of a word that can have several meanings). In this case
I'd support the second definition.

The OP intended "segment" as used in linker documentation or machine
architecture, things like ".data", ".bss", etc.

"segment" as cited above means "contiguous portion" or "subset" ... somewhat
different than the linker meaning.

If the specification includes an appendix on human parasitic infections and
they mention "segment" of a tapeworm, would it be fair to say that a
"segment" when talking about a tapeworm is different than a "segment" when
talking about a linker map? ... I kind of think they are different.

Dec 29 '06 #7
In article <3z************ *******@fe43.us enetserver.com> ,
David T. Ashley <dt*@e3ft.comwr ote:
>>>>raghu said:
>>>>Can anyone please tell me what are the different segments in a C
program?
>If the specification includes an appendix on human parasitic infections and
they mention "segment" of a tapeworm, would it be fair to say that a
"segment" when talking about a tapeworm is different than a "segment" when
talking about a linker map? ... I kind of think they are different.
That's fine, but the original poster did not say anything about
linker maps. I have quoted what was actually said, above.
If "segment" is mentioned only in connection with str[c]spn, then
it is only in connection with uses of str[c]spn that one has
"different segments in a C program".
(To clarify my position, I was the first to reply, and I posted a
"that's system specific; see further discussion at" answer. But then
I nitpicked Richard's answer, seeing as "Free Nitpicking!" is the
official newsgroup motto ;-) )
--
There are some ideas so wrong that only a very intelligent person
could believe in them. -- George Orwell
Dec 29 '06 #8
David T. Ashley said:
"Richard Heathfield" <rj*@see.sig.in validwrote in message
news:c7******** *************@b t.com...
<snip>
>I am guilty of jumping to a conclusion. The Standard does indeed use the
term 'segment' in the docs for strcspn and strspn, to refer to the first
part of a string.

Ah ... actually, you were right the first time.
No, I was wrong. The term *is* used within the C spec.
The term as the OP intended is not really used.
Probably true, and that's why I replied as I did originally. Nevertheless,
we only know what he said, not what he meant.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Dec 29 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4369
by: Attila.Rajmund.Nohl | last post by:
Hello! I'm using KAI C++ Compiler (KCC) Version 4.0d on Sparc Solaris 8 with Sun WorkShop 6 update 2 backend (KCC compiles C++ code to C than uses the Sun compiler to produce machine executables). When I run our program under purify to check for memory errors, I get the following interesting error messages: MSE: Memory segment error: * This is occurring while in:
5
12884
by: tkestell | last post by:
Is their anyway to perform mass deletes (several million records) without "maxing out" rollback segments? I'm working on archiving data from an Oracle 8.1.7 database The system is about 4 years old and no data has EVER been archived /removed. So the two largest tables contain well over 25 million records! As part of the archive process I'm deleting out-dated records, but because of the sheer volume keep receiving "Unable to extend...
3
1966
by: Stephen S M WONG | last post by:
As C++ program supports objects with constructors/destructors/methods and data items, I'll assume C++ implementation on segment model computer, like a 80286 with different access restrictions on code segment / data segment / etc., will force all objects to be resided in a code segment, so that executable code can be there as well as data. And effectively bypassing all segment model. Any comments on the above?
4
2849
by: cppsks | last post by:
I have been working on making a constant array available for the clients. However, it is placing it in the text segment, and external references result in unresolved references to the array. Taking the const off the definition solves the problem (the variable is placed in the data segment). Is this how const globals are supposed to work, or did the linker screw up? Thanks.
2
2902
by: James FitzGerald | last post by:
I am building a small memory model DOS exe (does not actually run in dos but in a custom 16bit environment). For complex reasons I am not allowed to have any relocatable items. I have run into a problem where the compiler is putting my vtables into a new segment (COMDAT_SEG1). I would like to force the compiler to stick these into a default segment such as the _TEXT segment or _CODE segment. The classes are defined as far, and need...
65
12629
by: Skybuck Flying | last post by:
Hi, I needed a method to determine if a point was on a line segment in 2D. So I googled for some help and so far I have evaluated two methods. The first method was only a formula, the second method was a piece of C code which turned out to be incorrect and incomplete but by modifieing it would still be usuable. The first method was this piece of text:
5
11364
by: druberego | last post by:
I read google and tried to find the solution myself. YES I do know that you can get undefined references if you: a) forget to implement the code for a prototype/header file item, or b) you forget to pass all the necessary object files to the linker. Neither of those are my problem. Please bear with me as the question I ask is rather long and I think it's beyond a CS101 level of linker stupidity. If it is a stupid CS101 mistake I'm making...
4
6987
by: jesjak | last post by:
hi all, can any one give me some explanation of "wat is .bss segment in object file" and what it will contain and difference between data segment and .bss segment.... help me.... thanks, jes
3
2156
by: madshov | last post by:
Hi, I have the following: <start> <segment Id="AAA"> <element Id="id">1</element> <element Id="seq">122</element> <element Id="seq2" Composite="yes">
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10285
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10063
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9114
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.