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

static members

P: n/a
hi:

for static variables, are the static variable defined inside a function
and the static variable defined outside a function allocated to the same
segment? (data segment)

also, when a C program is compiled/linked, there are several segments,
like data, BSS, stack, etc. What else? is there some good website about
this?

thanks,

bo

Nov 14 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
Bo Sun wrote:
hi:

for static variables, are the static variable defined inside a function
and the static variable defined outside a function allocated to the same
segment? (data segment)

also, when a C program is compiled/linked, there are several segments,
like data, BSS, stack, etc. What else? is there some good website about
this?


None of this is defined by the C standard, and the thing about
"segments" isn't even true on all implementations.

Your question seems to be about some specific implementation(s), and
therefore is off-topic here. Try a group that deals with your compiler
or OS.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Nov 14 '05 #2

P: n/a
"Bo Sun" <b0*****@cs.tamu.edu> wrote in message
news:Pi*******************************@unix.cs.tam u.edu...
for static variables, are the static variable defined inside a function
and the static variable defined outside a function allocated to the same
segment? (data segment)
C could not care less. They have static storage duration, that's all you
need to know.
also, when a C program is compiled/linked, there are several segments,
like data, BSS, stack, etc. What else? is there some good website about
this?


I'm afraid this depends on your architecture (Intel? Alpha? DS9k?),
operating system (Windows? Any of hundreds flavours of Unix? DS9kOS?), your
compiler, even the compiler settings. The best reference is undoubtedly your
compiler's manual.

Peter
Nov 14 '05 #3

P: n/a
> also, when a C program is compiled/linked, there are several segments,
like data, BSS, stack, etc. What else? is there some good website about
this?


The following article should help:
http://www.biglal.net/Memory.html

Sandeep
--
http://www.EventHelix.com/EventStudio
EventStudio 2.0 - Go Beyond UML Use Case and Sequence Diagrams
Nov 14 '05 #4

P: n/a
EventHelix.com wrote:
also, when a C program is compiled/linked, there are several segments,
like data, BSS, stack, etc. What else? is there some good website about
this?


The following article should help:
http://www.biglal.net/Memory.html


Here's a quote from that site:

"Everthing inside of a computer is in binary. Programs, text files, music,
and everything else has been simplified to a linear set of bytes, with each
byte consisting of eight bits."

This is simply wrong, as a cursory reading of the Standard will show.

Please, please, PLEASE stop posting URLs full of mistakes.

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #5

P: n/a
Richard Heathfield writes:
EventHelix.com wrote:
also, when a C program is compiled/linked, there are several segments,
like data, BSS, stack, etc. What else? is there some good website about
this?
The following article should help:
http://www.biglal.net/Memory.html


Here's a quote from that site:

"Everthing inside of a computer is in binary. Programs, text files,

music, and everything else has been simplified to a linear set of bytes, with each byte consisting of eight bits."

This is simply wrong, as a cursory reading of the Standard will show.

Please, please, PLEASE stop posting URLs full of mistakes.


How about if he had said "Everything inside a modern desktop, elctronic,
digital computer is in binary"? Would you have been happy then? Do you
think that qualification ridden drek would have slowed down the
comprehension of the reader?

In the US we expect a doorknob to be at a certain place. If the plans for
the replacement World Trade Center have to specify what a suitable doorknob
location is, do you think it might be an encumbrance that doesn't really
accomplish anything?

I would suggest finding something more objectionable than that or remaining
silent.

vapid^vapid.
Nov 14 '05 #6

P: n/a
"osmium" <r1********@comcast.net> writes:
Richard Heathfield writes:
EventHelix.com wrote:
> also, when a C program is compiled/linked, there are several segments,
> like data, BSS, stack, etc. What else? is there some good website about
> this?

The following article should help:
http://www.biglal.net/Memory.html
Here's a quote from that site:

"Everthing inside of a computer is in binary. Programs, text files,
music, and everything else has been simplified to a linear set of
bytes, with each byte consisting of eight bits."

This is simply wrong, as a cursory reading of the Standard will show.

Please, please, PLEASE stop posting URLs full of mistakes.


How about if he had said "Everything inside a modern desktop, elctronic,
digital computer is in binary"? Would you have been happy then?


The statement "Everthing inside of a computer is in binary" makes little
sense. The most important things inside of a computer are made of silicon,
not "in binary." Various other materials appear as well.

However, the really objectionable statement is the claim that a byte
consists of eight bits. That is simply wrong.
I would suggest finding something more objectionable than that or
remaining silent.


For the benefit of archive readers, mistakes and wrong statements must be
corrected, so Richards post was definitely necessary.

Martin
Nov 14 '05 #7

P: n/a
Richard Heathfield wrote:
EventHelix.com wrote:

.... snip ...

The following article should help:
http://www.biglal.net/Memory.html


Here's a quote from that site:

"Everthing inside of a computer is in binary. Programs, text
files, music, and everything else has been simplified to a linear
set of bytes, with each byte consisting of eight bits."

This is simply wrong, as a cursory reading of the Standard will
show.

Please, please, PLEASE stop posting URLs full of mistakes.


It appears as if EventHelix is another poster that needs to be
watched and continuously corrected in order to protect the young
and innocent.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #8

P: n/a
osmium wrote:
Richard Heathfield writes:
EventHelix.com wrote:
> The following article should help:
> http://www.biglal.net/Memory.html


Here's a quote from that site:
....which I've taken this opportunity to re-flow.
"Everthing inside of a computer is in binary. Programs,
text files, music, and everything else has been simplified
to a linear set of bytes, with each byte consisting of eight
bits."

This is simply wrong, as a cursory reading of the Standard will show.

Please, please, PLEASE stop posting URLs full of mistakes.


How about if he had said "Everything inside a modern desktop, elctronic,
digital computer is in binary"? Would you have been happy then? Do you
think that qualification ridden drek would have slowed down the
comprehension of the reader?


You have misunderstood my objection. Note the words "as a cursory reading of
the Standard will show". Can you now see what I was talking about? Can you
now see why, within the context of *this* newsgroup, the URL quote was
simply and /relevantly/ wrong?

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #9

P: n/a
Richard Heathfield writes:
osmium wrote:
Richard Heathfield writes:
EventHelix.com wrote:

> The following article should help:
> http://www.biglal.net/Memory.html

Here's a quote from that site:
...which I've taken this opportunity to re-flow.
"Everthing inside of a computer is in binary. Programs,
text files, music, and everything else has been simplified
to a linear set of bytes, with each byte consisting of eight
bits."

This is simply wrong, as a cursory reading of the Standard will show.

Please, please, PLEASE stop posting URLs full of mistakes.
How about if he had said "Everything inside a modern desktop, elctronic,
digital computer is in binary"? Would you have been happy then? Do you
think that qualification ridden drek would have slowed down the
comprehension of the reader?


You have misunderstood my objection. Note the words "as a cursory reading

of the Standard will show". Can you now see what I was talking about? Can you
now see why, within the context of *this* newsgroup, the URL quote was
simply and /relevantly/ wrong?


I took it that you were objecting to the eight-bit byte. Is that not so? My
intent was to qualify the hell out of things so that the eight-bit byte
became true. In retrospect, I see that I should have also included
"general-purpose" so as to exclude 9-bit coffee makers and so on. There is
an alternative, which I like even less, which is to say "sometimes an
eight-bit byte". As I understand the embedded contingent, you can't even
say "usually an eight-bit byte", without causing hissy fits.

I didn't look at the link but I am sure if you really apply yourself you
could find a more substantive objection to the author's attempt to help
people.
Nov 14 '05 #10

P: n/a
osmium wrote:
I took it that you were objecting to the eight-bit byte. Is that not so?
Yes, that's right.
My intent was to qualify the hell out of things so that the eight-bit byte
became true.
And yet I've worked in places where they keep modern electrical digital
computers with 32-bit bytes on the desktop. :-)
I didn't look at the link but I am sure if you really apply yourself you
could find a more substantive objection to the author's attempt to help
people.


I, too, am sure that I could. I am not quite so sure, however, that it's a
good use of my time. :-)
--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #11

P: n/a
osmium wrote:
Richard Heathfield writes:
.... snip ...

You have misunderstood my objection. Note the words "as a
cursory reading of the Standard will show". Can you now see what
I was talking about? Can you now see why, within the context of
*this* newsgroup, the URL quote was simply and /relevantly/ wrong?

.... snip ...
I didn't look at the link but I am sure if you really apply yourself
you could find a more substantive objection to the author's attempt
to help people.


_Wrong_ advice does /not/ help people. This newsgroup deals with
the C language as defined by the various C standards, and advice
should apply to any system meeting such standards. Richard
realizes this very well, and has simply attempted a correction so
that others will not be misinformed, and to attempt to educate the
OP about the reasons for the objection.

It is not really helpful to step in and claim that anyone can use
any patois of a language they wish. If you want some sort of
no-holds-barred newsgroup this is not it.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.