|
charlieg wrote: But someone just declared war on France. That "someone" is not recognized as a state o'er here.
And no, we do not "declare war" on everything around here. War is often not a very constructive way of solving issues.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Indeed... What a tragedy folks...
... having only that moment finished a vigorous game of Wiff-Waff and eaten a tartiflet. - Henry Minute
I'm still looking (eagerly) for wisdom in terms of best practices in OO design; and I doubt I'll ever quit looking. - BillWoodruff
Programming is a race between programmers trying to build bigger and better idiot proof programs, and the universe trying to build bigger and better idiots, so far... the universe is winning. - gavindon
|
|
|
|
|
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Thank You
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
Thank You
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
|
Never rapped to do it
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
modified 13-Nov-15 20:52pm.
|
|
|
|
|
Er, I think you dropped a 'p' there.
Software Zen: delete this;
|
|
|
|
|
Possible, I am French and my English spelling can be approximative
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
I didn't actually think this was possible:
class MyClass
{
OtherClass _otherClass;
...
public Populate()
{
OtherClass _otherClass = new OtherClass();
...
...
}
public void Process()
{
if (_otherClass.HasNoData)
TotallyFreakOut();
}
}
var thing = new MyClass();
thing.Populate();
thing.Process();
The gist is that I have a class with a member variable _otherClass . I initialise and fill that _otherClass with stuff in one method, then access and process _otherClass in another. The problem was that in the other method I was finding _otherClass empty, even though I'd traced line by line watching data be assigned to _otherClass .
I honestly thought the compiler would catch that - but evidently not! Live and learn.
cheers
Chris Maunder
|
|
|
|
|
Not classy, not classy at all.
|
|
|
|
|
That is expected, and the answer is "scope is a b*tch!"
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Chris Maunder wrote: I honestly thought the compiler would catch that It does. If you don't initialize this._otherClass .
/ravi
|
|
|
|
|
Is this beyond the scope of it being Friday the 13th?
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
You populated my head with buggy code, yet when I went and processed that code I found nothing!
I had to watch three times to find the bug
|
|
|
|
|
It won't compile because "public Populate()" is not valid without a return type.
If it's a CTOR, then it's named wrong. If it's a method, it needs a return type.
If it's not broken, fix it until it is
|
|
|
|
|
Hmm. VS2008 would issue a warning for hiding the _otherClass member variable. If you're using something later, it could be they've eliminated the warning.
Oh no.
You are compiling with warnings set to maximum pedantry, aren't you?
Software Zen: delete this;
|
|
|
|
|
I'm compiling with warnings set to "Ring the Klaxons".
But yes - I assumed this would happen too. It was a nice head slapper.
cheers
Chris Maunder
|
|
|
|
|
Resharper catches this. It will underline your variable (_otherClass in Populate()) in blue, and if you hover it, it will show you that it hides the one from outer scope.
Best,
John
-- LogWizard Meet the Log Viewer that makes monitoring log files a joy!
|
|
|
|
|
Chris Maunder wrote: public void Process()
{
if (_otherClass.HasNoData)
TotallyFreakOut();
}
public void Process()
{
if (_otherClass.HasNoData)
TotallyFreakingWatchForLocalVariablesDeclWithUnderscores();
}
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
That's the whole point: I didn't realise I was declaring a local var with an underscore.
It never ceases to amaze me at what we don't see[^].
cheers
Chris Maunder
|
|
|
|
|
I totally missed the Putin thing on the Video.
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
Is there anybody out there who made the same experience like me?
The longer I'm working with InstallShield, the more I'm keen on drugs
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Try to work more on DrugShield and process more installations.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|