473,394 Members | 1,703 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,394 software developers and data experts.

static members

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

Similar topics

3
by: DanielBradley | last post by:
Hello all, I have recently been porting code from Linux to cygwin and came across a problem with static const class members (discussed below). I am seeking to determine whether I am programming...
8
by: Scott J. McCaughrin | last post by:
The following program compiles fine but elicits this message from the linker: "undefined reference to VarArray::funct" and thus fails. It seems to behave as if the static data-member:...
15
by: Samee Zahur | last post by:
Question: How do friend functions and static member functions differ in terms of functionality? I mean, neither necessarily needs an object of the class to be created before they are called and...
6
by: lovecreatesbeauty | last post by:
Hello Experts, Why static data members can be declared as the type of class which it belongs to? Inside a class, non-static data members such as pointers and references can be declared as...
13
by: Adam H. Peterson | last post by:
I just made an observation and I wondered if it's generally known (or if I'm missing something). My observation is that static protected members are essentially useless, only a hint to the user. ...
3
by: Mauzi | last post by:
hi, this may sound odd and noob like, but what is the 'big' difference between static and non-static funcitons ? is there any performace differnce? what is the best way to use them ? thnx ...
6
by: Matt | last post by:
All of a sudden all my C# apps require the keyword static on all global fields and methods that I create. Even in the simplest of console apps. Can someone tell me what I have inadvertenly set in...
11
by: dee | last post by:
OleDbCommand class like many .NET classes has the following description in its help file: "Thread Safety Any public static (Shared in Visual Basic) members of this type are safe for...
11
by: Kevin Prichard | last post by:
Hi all, I've recently been following the object-oriented techiques discussed here and have been testing them for use in a web application. There is problem that I'd like to discuss with you...
8
by: crjjrc | last post by:
Hi, I've got a base class and some derived classes that look something like this: class Base { public: int getType() { return type; } private: static const int type = 0; };
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.