Stefan Küng wrote:
> On 4/10/06, Norbert Unterberg <nunterberg@gmail.com> wrote:
>
>> The only thing I can think of (except overclocking or overheating) is
>> that some other thread is changing cachedDir in between these two
>> lines. I do not know the context, but I guess cachedDir is a local
>> variable? If yes, then I am out of ideas.
>>
>
> Yes, cachedDir is a local variable, so it can't be changed by another
> thread. Ok, another thread can mess with the object cachedDir points
> to, but it can't set cachedDir itself to NULL.
>
> Stefan
>
>
Several possibilities surface.
1 Is cachedDir's state guaranteed to be correct or initialized
correctly on entry to the function where it has scope *every time* ?.
2 Is the the full length evaluated? i.e.is there a chance that only
part of the variable is evaluated when determining the NULL condition?
Instead of treating the variable as a boolean, for the purposes of
testing for NULL is there a specialized function for evaluating object
pointers for NULL?
Peter
Received on Mon Apr 10 13:04:42 2006