[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:       Grzegorz Piotr Jaskiewicz <gj () pointblue ! com ! pl>
Date:       2005-06-26 19:27:22
Message-ID: 200506262127.23671 () gj-laptop
[Download RAW message or body]

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.

-- 
GJ
_______________________________________________
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