static members

B

Bo Sun

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
 
K

Kevin Goodsell

Bo said:
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
 
P

Peter Pichler

Bo Sun said:
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
 
R

Richard Heathfield

EventHelix.com said:
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.
 
M

Martin Dickopp

osmium said:
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
 
C

CBFalconer

Richard said:
EventHelix.com wrote:
.... snip ...

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.
 
R

Richard Heathfield

....which I've taken this opportunity to re-flow.
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?
 
O

osmium

Richard said:
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.
 
R

Richard Heathfield

osmium said:
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. :)
 
C

CBFalconer

osmium said:
Richard Heathfield writes:
.... snip ...
.... 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.
 
O

osmium

Richard said:
...which I've taken this opportunity to re-flow.


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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top