variable allocated from stack/bss ??

M

MQ

CBFalconer said:
An off-topic reply will probably not be properly criticized, since
the experts are reading other newsgroups, where the subject is
topical. No one is perfect, so erroneous answers can always
appear. They do the least harm when rapidly corrected.

The OP probably (we have notable exceptions rampant here) didn't
know the subject was off-topic. The (mistaken) answerer has no
such excuse.

If the answer was incorrect, then I agree it is relevant to correct it.
In yours (and many others) mind it was incorrect, but I do not agree.
I would wager that the OP prefers my answer to any of the other posts
that provided no help at all.

People who post to newsgroups want a simple correct answer. My answer
was simple and "correct enough". They do not want to be preached to by
purists. This is by far one of the least tolerant technical newsgroups
that I have ever encountered. Why can't you guys relax and take your
wives out for dinner or something...
 
M

MQ

Tom said:
Aha, your problem. This isn't a programmers newsgroup. It's a
language group, and specifically the C language (and not its
non-standard extensions).

If you want to discuss programming issues take it up in another group.

Tom

This is exactly the sort of pompous vision that you can fight to your
dying days and will never win. It is an unmoderated newsgroup. People
will make their own judgement on what they want to post.
 
S

santosh

People who post to newsgroups want a simple correct answer.

Yes, as long as the post to the correct group. If they ignore
topicality when posting then the answers may be simple but are not
likely to be correct.

The stack and the layout of the program in memory is subtly different
according to the hardware, the operating system, the compiler that
happens to compile the language, and the linker and/or loader. These
are specifically implementation and machine dependant details, and are
not topical for a group that deals with the abstract form of the
language.

As I said in another post, any of comp.compilers, comp.arch,
comp.hardware, comp.os.linux.* or comp.os.ms-windows.* would have been
better places as the case may be.

<snip>
 
M

MQ

Martin said:
There is no such requirement for an implementation of the C programming
language. There is, in fact, no requirement for things called 'stack'
or 'BSS' to even exist. Please don't give such foolish and incorrect
'answers'. They only show your limited experience and lack of
qualification to give meaningful answers.

Well, you show your lack of professionalism by insulting my experience
and qualifications. The answer is correct because it answers the OP's
question sufficiently (but may have not been complete). Do not show
*your* foolishness by engaging in personal insults
 
C

Chris Dollin

MQ said:
People who post to newsgroups want a simple correct answer. My answer
was simple and "correct enough". They do not want to be preached to by
purists. This is by far one of the least tolerant technical newsgroups
that I have ever encountered.

Some of don't regard that as necessarily bad.

How tolerant to you want us to be? Should we answer questions on C++?
What about Qt? Sockets? HTTP? MS Access? HTML? Graphic design? CCGs?
Compilation technology? The x86 instruction set? The ARM instruction
set? RISC OS? Go on, why not? How about Swing? I've got this interpreted
language and the interpreter's written in C, so the language is on-
topic, right? And language design. How about closures and objects,
they're part of C#, so they're topical, aren't they?

What we're here for is to offer (and receive) help on & discuss the C
language as defined by the Standards and "closely related" stuff. There's
plenty of C-stuff to discuss, it's not as though we're short of material,
and every atopical item is clutter, makes it harder to see the C stuff,
and -- when it is responded to with other than a redirection to a more
appropriate group -- risks the response not being reviewed by the
appropriate experts.

We have our troubles. They won't be cured by widening the range of
material discussed.
Why can't you guys relax and take your wives out for dinner or something...

What makes you think we don't (up to mumblemorphism)?
 
R

Richard Bos

MQ said:
If the answer was incorrect, then I agree it is relevant to correct it.
In yours (and many others) mind it was incorrect, but I do not agree.
I would wager that the OP prefers my answer to any of the other posts
that provided no help at all.

People who post to newsgroups want a simple correct answer.

Sure. The problem is that there is no such thing.
My answer was simple and "correct enough".

Only for amateur programmers. If the OP wants to become a professional,
he would be advised not to assume that all the world's a Windows
machine.

Richard
 
K

Kenneth Brody

MQ said:
This is exactly the sort of pompous vision that you can fight to your
dying days and will never win. It is an unmoderated newsgroup. People
will make their own judgement on what they want to post.

In that case, why do you insist that those who post replies must
follow your ideas on how to post?

And "unmoderated" doesn't mean "open discussion on any topic you
feel like".

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>
 
K

Kenneth Brody

Richard said:
MQ said: [...]
Given that the poster
obviously is working on a platform that uses stack/BSS, the answer is
clear, even though the question is somewhat off-topic

The answer is misleading, because by the very nature of things it gives the
impression that you are giving a "C answer", this being comp.lang.c,
whereas in fact you're guessing at the OP's implementation characteristics
and answering as if you had guessed correctly.

Which is why, if I happen to know the answer to an OT question, I
might post the answer along the following lines:

This is OT for clc, but you are probably looking for the
DoTheThingThatHeWants() Windows API call. If you need more
help, you'll need to ask one of the Windows-specific groups,
such as ...


--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>
 
K

Kenneth Brody

Keith said:
printf("%d\n",i); [...]
The program exhibits undefined behaviour for not just one but two
reasons, one of which is that printf is not properly prototyped.

Irrelevant heathfield, completely irrelevant. Non
prototyped functions are assumed returning an int.
So what?

printf is a variadic function. Calling a variadic function with no
prototype in scope invokes undefined behavior. Without a prototype, a
function is assumed, in C90, to be a function returning int and taking
a fixed but unspecified number and type of arguments; printf does not
qualify. An implementation could use a completely different calling
convention for variadic functions than for non-variadic functions. If
you call a variadic function using a non-variadic calling convention,
it could easily fetch an argument value from the wrong location. One
possible result: printf prints 42 even though i==0.
[...]

As mentioned elsewhere, I have used platforms that will pass the
first few parameters to non-varadic functions in registers, rather
than on the stack. (Yes, this particular implementation has a
stack, even though it can be faster to not use it in this case.)
However, varadic functions get all of their parameters passed on
the stack.

Therefore, printf() will expect the format string to be passed on
the stack, whereas the calling function has passed it in a register.

*Boom*

QED.

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>
 
K

Kenneth Brody

santosh said:
I suppose functional equivalents of these would be considered a minimum
in any modern programming environment.

Perhaps. However, none of those are related to the C language
itself. After all, you might use the same linker, debugger, and
executable format while using Fortran.
Besides, strictly speaking, the C standard doesn't specify the method
by which C source is executed. I suppose a human who reads a source,
checks it syntactically and semantically, and manages to output the
expected results, could be considered a C compiler and execution
environment.

True.

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>
 
R

Richard Heathfield

jacob navia said:

I am not speaking in the name of anyone but me.

Good, good...
And I can say whatever I find correct to say.

Whatever you *think* correct. If you had truly found the correct answer,
presumably you would have published a retraction by now.
If you do not agree you have the right to disagree
and to say whatever you want. But I do not accept your
views (as should be obvious by now) so it is better
to leave at that.

It isn't a matter of your view and my view. It's a matter of what is, or is
not, defined by the C language.
 
K

Kenneth Brody

jacob navia wrote:
[...]
When I say that all programs under windows use ExitProcess to finish
the clever heathfield answers

Hmm... None of _my_ Windows programs call ExitProcess() to finish.
They either call exit(), abort(), or return from main().

Well, perhaps the underlying C runtime libraries call ExitProcess()
for me? That may be the case (or it may not be the case), but it's
still irrelevent as far as clc is concerned.
"I can always unplug the machine from the mains, then the
process finishes without calling ExitProcess"

I was figuring on simply dereferencing NULL, but I like yours
better. After all, perhaps the O/S calls ExitProcess() for me
when I crash the program?
When I say that the uninitialized variables section is mapped
in most systems to the BSS section santosh says that there is no machine
CBFacloner says there is no linker and no debugger, and that is it.

C runs without a machine santosh. You are RIGHT!!!

I guess it depends on your definition of "machine". If you
consider the human brain to be a "machine", then I guess you
are correct that there must be some "machine" to execute the
code. (On the other hand, who says you need to compile and
execute the code? Why not just write the code for code's
sake?)

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>
 
R

Richard Heathfield

MQ said:

It is an unmoderated newsgroup. People
will make their own judgement on what they want to post.

They will also make their own judgement on what they want to read. The more
off-topic stuff you post, the more likely it is that those who want to
discuss C (in this here C forum) will not bother to read what you write
except, perhaps, to post corrections to your mistaken advice. So when *you*
need help with C, you'll be far less likely to get it.

In case that sounds like some kind of threat, it isn't intended as one.
Rather, I'm trying to express my concern that you should not yourself lose
access to first-class help on the C language because the C experts here
become fed up with your posting off-topic material.
 
R

Richard Heathfield

MQ said:
Well, you show your lack of professionalism by insulting my experience
and qualifications.

He wasn't insulting you. He was describing your lack of experience and
ability to give meaningful answers in comp.lang.c.
The answer is correct

No, it isn't.
because it answers the OP's question sufficiently

No, it doesn't.
(but may have not been complete). Do not show
*your* foolishness by engaging in personal insults

But Martin didn't do that. Not that he isn't capable of it at times, but he
did not do so on this occasion.
 
W

William Hughes

MQ said:
Well, you show your lack of professionalism by insulting my experience
and qualifications. The answer is correct because it answers the OP's
question sufficiently

Piffle. A sufficient answer would at least have pointed out that
the question of memory layout are
implementation specific. To omit this is to make the same
"all the world is an X machine" error made by the OP.
Since this is a mistake associated with programmers of limited
experience, it invites that assumption about you.

- William Hughes
 
A

Al Balmer

The poster wanted help, I provided that help. Off-topic or not, how
hard is it for the CLC bureaucracy to at least help them out, *then*
tell them that they are at the wrong newsgroup. Sometimes an answer,
if not absolute, is better than no answer at all. And no answer at all
is 90% of this thread.

How hard would it be to redirect the poster, then answer his question
in the proper place after he does so? That would help him out a lot
more.
 
A

Al Balmer

This is exactly the sort of pompous vision that you can fight to your
dying days and will never win. It is an unmoderated newsgroup. People
will make their own judgement on what they want to post.

You'll find also, that people will make their own judgment about which
posters to read and respond to. In the past, posters who persist in
doing the things you're encouraging have found themselves eventually
isolated. This group is as valuable as it is in great part because
topicality is respected.

I've seen too many technical newsgroups deteriorate to the point of
uselessness, primarily because they failed to enforce topicality.

I have an advantage. Though I consider myself a competent C
programmer, I'm not one of the gurus here, and feel no obligation to
correct the off-topic and incorrect postings of the unwashed masses.
Therefore, I can improve my c.l.c. experience by filtering the likes
of Xah, E. Robert Tisdale, Kenny McCormick, and Jacob Navia (who is
banned off and on when the irritation level gets too high. I would
rather not add you to that list.
 
K

Keith Thompson

jacob navia said:
I am not speaking in the name of anyone but me.
And I can say whatever I find correct to say.
If you do not agree you have the right to disagree
and to say whatever you want. But I do not accept your
views (as should be obvious by now) so it is better
to leave at that.

No, if you post misinformation it is better to post a correction.

(Incidentally, you've used the phrase "Be it." several times; I think
what you mean is "So be it".)
 
C

CBFalconer

Al said:
How hard would it be to redirect the poster, then answer his
question in the proper place after he does so? That would help
him out a lot more.

Or, if you absolutely have to see your immortal prose displayed,
add a crosspost to <correct-newsgroup> with a follow-up to
<correct-newsgroup> (assuming <correct-newsgroup> is known to
you). The result will then get properly vetted. You can then join
in the chorus loudly castigating any idiot who overrides the
follow-up.

Aside: Does the (adjectives suppressed) google interface heed
follow-ups? cross-posts?
 
C

Charlton Wilbur

RH> They will also make their own judgement on what they want to
RH> read. The more off-topic stuff you post, the more likely it is
RH> that those who want to discuss C (in this here C forum) will
RH> not bother to read what you write except, perhaps, to post
RH> corrections to your mistaken advice. So when *you* need help
RH> with C, you'll be far less likely to get it.

Indeed, in some of the other threads going on right now, you can watch
this happening before your very eyes.

RH> In case that sounds like some kind of threat, it isn't
RH> intended as one. Rather, I'm trying to express my concern
RH> that you should not yourself lose access to first-class help
RH> on the C language because the C experts here become fed up
RH> with your posting off-topic material.

And that we *all* lose access to first-class knowledge of the C
language because the C experts here become fed up with all the people
posting off-topic material and leave.

This is also happening.

Charlton
 

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,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top