On Thursday 23 November 2006 20:27, Frederic Bouvier wrote:
> Durk Talsma a écrit :
> > Okay, that seems a reasonable request, which I can do, provided no ill
> > side effects show up on my development box.
> >
> > Still, I'd be interested in the expert opinion of another C++ coder who's
> > more familiar with MSVC than I am.
>
> I thing comparing iterators on different containers is at least
> meaningless, if not illegal, even if the containers are of the same type.
>
> At line 807 of groundnetwork.cxx, current is an iterator on
> activeTraffic, and i is an iterator on towerController->getActiveTraffic()
>
Incedentally, It's absolutely true that the comparison here is meaningless.  
Because the iterators are from two different containers, they cannot point to 
the same object. (Unlike other comparisons of i != current, which do compare 
iterators from the same container). It looks like this comparison sneaked in 
by accident, and since it never failed on my system, I didn't catch it.  
I didn't realize that there is indeed a difference between the i != current 
and the other iterator comparisons, Which is the within vs. between container 
comparison. Ift he between container  comparison is undefined, it is very 
plausible that it's behavior will vary from compiler to compiler. 

The most proper solution in this case is probably to remove the conditional if 
(current != i) (Since it cannot be false anyways). I'll give it a test, and 
if it works satisfactory I'll check it in. 

Thanks for the explanation Fred.

Cheers,
Durk



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to