473,396 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 3452
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
"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
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.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
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
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
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...
5
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...
3
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...
4
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...
2
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...
65
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...
5
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...
4
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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,...

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.