|
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 !~
|
|
|
|
|
Thanks for your Suggestion. I think I will try for wix ...
... and the meaning of "wix" in German (more in Swiss German) I'm not allowed to explain it here. Even for Soapbox it is not appropriate
modified 19-Jan-21 21:04pm.
|
|
|
|
|
I'm in InstallShield every f'in day.
Now if you'll excuse me, I have to go pick up my stash.
|
|
|
|
|
Only one hint please before I give myself the golden shot...
There was a time i could do something like this for compents:
[INSTALLDIR]..\Share
or
[TARGETDIR]..\Share
I know it something dirty but it worked. Since IS2008 this seems not to be possible.
Do you have a hint how to refer "Company Folder"?
Thank you in advance
modified 19-Jan-21 21:04pm.
|
|
|
|
|
To keep things simple, I never use property values in paths. Someone will probably have to come in after my work on on the next version of the package to work on it.
But, it is possible to do, you just need a custom action to resolve the name. It's a little tricky to setup, but here[^] is a good explanation of how to do it.
|
|
|
|
|
Thank you very much for this.
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Don't use InstallS***. I use Wix. Much better.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music."
-- Marcus Brigstocke, British Comedian
|
|
|
|
|
Quote: I use Wix. Much better.
Agreed! And it's free!
How do we preserve the wisdom men will need,
when their violent passions are spent?
- The Lost Horizon
|
|
|
|