[Issue 1227] New: Access Violation when using comparison of template class pointer
david
ta-nospam-zz at gmx.at
Fri May 11 10:19:19 PDT 2007
Jarrett Billingsley schrieb:
> <d-bugmail at puremagic.com> wrote in message
> news:bug-1227-3 at http.d.puremagic.com/issues/...
>> http://d.puremagic.com/issues/show_bug.cgi?id=1227
>
> Not a bug. Use 'is' to see if a reference is null, not '=='.
>
>> public void add(TypeList T)
>> {
>> LinkedListLink!(TypeList) n;
>>
>> synchronized(this)
>> {
>> try
>> {
>> n = new LinkedListLink!(TypeList) (last,
>> T);
>> } catch (OutOfMemoryException e)
>> {
>> throw e;
>> }
>>
>> if ( this.last==null )
>
> This last line should be:
> if( this.last is null )
>
>> {
>> this.first = n;
>> this.last = n;
>> } else
>> {
>> this.last.next = n;
>> this.last = n;
>> }
>>
>> count++;
>> }
>> }
>> }
>
>
Reason:
if (window == null)
is another way of saying:
if (window.opEquals(null))
but if "window" is null, it will fail because it needs "window" for the
reference of the opEquals method to work.
david
More information about the Digitalmars-d-bugs
mailing list