By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,132 Members | 1,265 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,132 IT Pros & Developers. It's quick & easy.

Segment

P: n/a
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
Share this Question
Share on Google+
8 Replies


P: n/a
In article <11**********************@42g2000cwt.googlegroups. com>,
raghu <ra*********@gmail.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

P: n/a
"raghu" <ra*********@gmail.comwrote in message
news:11**********************@42g2000cwt.googlegro ups.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

P: n/a
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

P: n/a
In article <BL*********************@bt.com>,
Richard Heathfield <rj*@see.sig.invalidwrote:
>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

P: n/a
Walter Roberson said:
In article <BL*********************@bt.com>,
Richard Heathfield <rj*@see.sig.invalidwrote:
>>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

P: n/a
"Richard Heathfield" <rj*@see.sig.invalidwrote in message
news:c7*********************@bt.com...
Walter Roberson said:
>In article <BL*********************@bt.com>,
Richard Heathfield <rj*@see.sig.invalidwrote:
>>>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

P: n/a
In article <3z*******************@fe43.usenetserver.com>,
David T. Ashley <dt*@e3ft.comwrote:
>>>>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

P: n/a
David T. Ashley said:
"Richard Heathfield" <rj*@see.sig.invalidwrote in message
news:c7*********************@bt.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 discussion thread is closed

Replies have been disabled for this discussion.