[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kopete-devel
Subject:    Re: [kopete-devel] [PATCH] Avoiding to test on end()
From:       Michel Hermier <michel.hermier () wanadoo ! fr>
Date:       2005-06-26 19:31:59
Message-ID: 200506262134.43293.michel.hermier () wanadoo ! fr
[Download RAW message or body]

On Sunday 26 June 2005 19:27, Grzegorz Piotr Jaskiewicz wrote:
> On Saturday 25 June 2005 19:43, Michel Hermier wrote:
> > Hi,
> > This patch avoids to loop until reaching end(); while decrementing the
> > iterator. The current code is wrong for 2 reasons:
> > - decrementing to the begin of the list doesn't return the same value as
> > end(); - decrementing to the iterator at the first place, is undefined (see
> > http://doc.trolltech.com/3.3/qmapiterator.html#operator-- )
> > So this provoke an invalid read (potential crash).
> > 
> > Comments? commit?
> I'm sorry, but besides not using extra iterator this patch don't do anything 
> good. Makes code less readable.
> checking against end() everytime is good, you won't run into race cond, when 
> other thread, or something you just called remove/added few elements to your 
> list.
> 

Checking against end will -- an iterator is no good. Check the \
http://doc.trolltech.com/3.3/qmapiterator.html#operator-- before begin() there is \
undetermined :O and not end()

_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic