Steve555 said:
How does posting a complete tiny program satisfy being asked to post a
complete tiny program??
No, sorry, you'll have to run that one by me again!
<SIGH>
Steve, you left out the context that answers your own question.
What I wrote was:
"Uhhhmmm... How do you know? Both Alf and Jakob asks you to post the
tiniest possible source that shows the problem. How, exactly, does
this show the problem? "
Your response was:
"How does posting a complete tiny program satisfy being asked to post a
complete tiny program??"
That's a non-sequitur. I wasn't taking issue that the program you
posted was sufficiently small - it was, and thank you for making it
small. I was pointing out that it didn't show the problem. There was
nothing showing that that the value of x was zero - we just had you
telling us that it was, but how did you know? Were you running the
program under a debugger? What I was trying to subtly point out - I
guess too subtly - is that the program you post needs to show the
error. Traditionally, one does that either by sending the apparently
wrong value to std::cout so we can see it, or by including an assert.
In other words, you post a program and say "I was expecting the output
to be [whatever], but when I compile and run it, instead the output is
[whatever]. Please help me understand why."
Anyway, I'm glad your problem was solved.
========================================================
Tom,
First of all, I apologise for that mildly sarcastic tone. I didn't
understand from your question what you thought was lacking, so to me it
wasn't a non-sequitur. However, I understand now from your explanation,
and thank you for having the patience.
To answer your other question:
There was
nothing showing that that the value of x was zero - we just had you
telling us that it was, but how did you know?
Well, in the snippet below, it shows that GetVal() is called from main,
and so I could not fail to see x assigned a value, once I hit it in the
debugger: ( ... er, but as you say, I forgot to mention I was running
the debugger!)
----- In main.cpp: -----
#include "Test.h"
#include "GetVal.h"
int main(int argc, const char *argv[])
{
Test::myVal = 17;
GetVal();
}
void GetVal()
{
long x = Test::myVal;
}
(1. As I'm clearly floundering with my newsgroup technique, too, I
should point out that I'm not questioning any advice kindly given, just
that I don't fully understand some point.
2. I'm trying to post from Google, and it doesn't appear to do quoting,
so apologies for the ugliness of the manually cut'n'pasted bits)
Many thanks
Steve