Re: [Flightgear-devel] Patch for positioned.cxx

2009-02-23 Thread Geoff McLane
> not subscribed to the flightgear-cvslogs ML ? ;-)

No, was not, but am now!

Thanks Fred.

Geoff.



--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Patch for positioned.cxx

2009-02-22 Thread Frederic Bouvier
Geoff McLane a écrit :
>> Not that I have any objection to your patch, I just reacted to your
>> question that you have no idea how gcc can compile this.
>> 
>
> So, I simply hope some patch is added to 'help' those of us using the
> MSVC compiler in native WIN32, under what ever switches are deemed
> necessary, for whatever the reason... sorry I mentioned 'gcc' at
> all ;=))
>
> Who is going to apply a patch?
>
>   

not subscribed to the flightgear-cvslogs ML ? ;-)

-Fred

-- 
Frédéric Bouvier
http://my.fotolia.com/frfoto/   Photo gallery
http://fgsd.sourceforge.net/FlightGear Scenery Designer


--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Patch for positioned.cxx

2009-02-22 Thread Csaba Halász
On Sun, Feb 22, 2009 at 7:46 PM, Geoff McLane  wrote:
>
> Who is going to apply a patch?

Frederic has already applied it when he wrote his email.

-- 
Csaba/Jester

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Patch for positioned.cxx

2009-02-22 Thread Geoff McLane
> Not that I have any objection to your patch, I just reacted to your
> question that you have no idea how gcc can compile this.

So, I simply hope some patch is added to 'help' those of us using the
MSVC compiler in native WIN32, under what ever switches are deemed
necessary, for whatever the reason... sorry I mentioned 'gcc' at
all ;=))

Who is going to apply a patch?

Geoff.



--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Patch for positioned.cxx

2009-02-22 Thread Csaba Halász
On Sun, Feb 22, 2009 at 6:26 PM, Geoff McLane  wrote:
>
> template
> ForwardIterator lower_bound(
>  ForwardIterator _First,
>  ForwardIterator _Last,
>  const Type& _Val,
>  BinaryPredicate _Comp );
> 
> And similarly for upper_bound ...

Yes. So the range _First to _Last is traversed, comparing items to
_Val. That is, the _Comp will be called with an iterator (pointer) and
a const Type&.
So you don't need a two pointer version.
Not that I have any objection to your patch, I just reacted to your
question that you have no idea how gcc can compile this.

-- 
Csaba/Jester

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Patch for positioned.cxx

2009-02-22 Thread Geoff McLane
On Sat, 2009-02-21 at 21:07 +0100, Csaba Halász wrote: 
> On Sat, Feb 21, 2009 at 7:34 PM, Geoff McLane  wrote:
> >
> > IMHO the _MSC_VER and _DEBUG switches do NOT need to be applied. I am
> > forever puzzled how gcc resolves this since the comparison is indeed two
> > pointers ...
> 
> No it isn't. Both uses in lower_bound and upper_bound take an iterator
> range and a const Type&. So it is a pointer and a reference. gcc is
> right.
> 
Hi Csaba/Jester, ZhiYong Huang, and Fred, 

Hmmm, it has been quite a few months since I looked this up, but trying again 
with your idea,
I find, in the MSVC HELP :-


Finds the position of the first element in an ordered range that has a value 
greater than or
equivalent to a specified value, where the ordering criterion may be specified 
by a binary predicate.

template
ForwardIterator lower_bound(
 ForwardIterator _First,
 ForwardIterator _Last,
 const Type& _Val ); 
template
ForwardIterator lower_bound(
 ForwardIterator _First, 
 ForwardIterator _Last,
 const Type& _Val,
 BinaryPredicate _Comp );

And similarly for upper_bound ...

Then in positioned.cxx we have :-
BucketEntry::const_iterator l = std::lower_bound(it->second.begin(), 
it->second.end(), aLower, LowerLimitOfType());
BucketEntry::const_iterator u = std::upper_bound(l, it->second.end(), aUpper, 
LowerLimitOfType());

which is using the 2nd template, where BucketEntry is defined as -
typedef std::set BucketEntry;

So no problem here, but it is the 'BinaryPredicate _Comp', that is 
LowerLimitOfType(), 
which is defined as :-

class LowerLimitOfType
{
public:
bool operator()(const FGPositioned* a, const FGPositioned::Type b) const
{
return a->type() < b;
}
bool operator()(const FGPositioned::Type a, const FGPositioned* b) const
{
return a < b->type();
}
};

It seems here the comparator, LowerLimitOfType(), is 'missing' a comparison 
given 2
pointers - so the patch code provides this :-

+ bool operator()(const FGPositioned* a, const FGPositioned* b) const
+ {
+ return a->type() < b->type();
+ }

So this is NOT upper_bound or lower_bound case, but a user class case, but what 
do I know?

There is no 'competition' between which compiler is 'right' here ;=)) Just a 
case of finding
the lower limit of, given two pointers... Again I am forever 'puzzled' when any
compiler 'resolves' this without the above suggested addition to 
'LowerLimitOfType()???

Maybe Fred is right in suggesting the MSVC 'debugging code in the STL' triggers 
this, but
are we correct in 'ignoring' this extra help? this extra information?... at 
least for MSVC?

Alternatively, what can be WRONG with providing a clear cut solution to ANY and 
ALL 
compilers, and that is showing it EXACTLY what we want? The lower limit of the 
'type' 
of two pointer... if that is what we want!

But even if you decide to put the patch under a switch -
#if defined(_MSC_VER) && defined(_DEBUG)
then NO PROBLEM! 

Any patch is BETTER than NONE ;=))

Regards,

Geoff.



--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Patch for positioned.cxx

2009-02-22 Thread Frederic Bouvier
Csaba Halász a écrit :
> On Sat, Feb 21, 2009 at 7:34 PM, Geoff McLane  wrote:
>   
>> IMHO the _MSC_VER and _DEBUG switches do NOT need to be applied. I am
>> forever puzzled how gcc resolves this since the comparison is indeed two
>> pointers ...
>> 
>
> No it isn't. Both uses in lower_bound and upper_bound take an iterator
> range and a const Type&. So it is a pointer and a reference. gcc is
> right.
>   

IIRC, VS2005 has special debugging code in the STL that trigger this.
The problem doesn't occur with older compilers.

-Fred

-- 
Frédéric Bouvier
http://my.fotolia.com/frfoto/   Photo gallery
http://fgsd.sourceforge.net/FlightGear Scenery Designer


--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Patch for positioned.cxx

2009-02-21 Thread Csaba Halász
On Sat, Feb 21, 2009 at 7:34 PM, Geoff McLane  wrote:
>
> IMHO the _MSC_VER and _DEBUG switches do NOT need to be applied. I am
> forever puzzled how gcc resolves this since the comparison is indeed two
> pointers ...

No it isn't. Both uses in lower_bound and upper_bound take an iterator
range and a const Type&. So it is a pointer and a reference. gcc is
right.

-- 
Csaba/Jester

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Patch for positioned.cxx

2009-02-21 Thread Geoff McLane
Hi,

I have been applying this patch since sometime before Sep last year -
see -
http://geoffair.net/fg/txt/fgfs-047.patch.txt

IMHO the _MSC_VER and _DEBUG switches do NOT need to be applied. I am
forever puzzled how gcc resolves this since the comparison is indeed two
pointers ...

diff -ur CVS\FlightGear\source\src\Navaids\positioned.cxx FlightGear\src
\Navaids\positioned.cxx
--- CVS\FlightGear\source\src\Navaids\positioned.cxxMon Sep 08 21:25:45 2008
+++ FlightGear\src\Navaids\positioned.cxx   Sat Nov 01 19:02:22 2008
@@ -147,6 +147,10 @@
   {
 return a < b->type();
   }
+  bool operator()(const FGPositioned* a, const FGPositioned* b) const
+  {
+return a->type() < b->type();
+  }
 };
 
 static void

Hope this helps...

Regards,

Geoff.

On Sun, 2009-02-22 at 02:14 +0800, 黄志勇 wrote:
> Hi,
> Compiling the file positioned.cxx with MSVC in debug model, it have some 
> problems.
> but in release model , it have not.
> I think that it is the problem of implementation of STL by Microsoft in debug 
> model.
> So i add a method for class LowerLimitOfType, and it works.
> I'd be happy if someone considers commiting this.
> 
> Thanks, ZhiYong Huang
> 
> Index: positioned.cxx
> ===
> RCS file: /var/cvs/FlightGear-0.9/source/src/Navaids/positioned.cxx,v
> retrieving revision 1.12
> diff -u -r1.12 positioned.cxx
> --- positioned.cxx   9 Jan 2009 13:15:03 -   1.12
> +++ positioned.cxx   21 Feb 2009 17:54:27 -
> @@ -55,6 +55,9 @@
>}
>  };
>  
> +typedef std::set BucketEntry;
> +typedef std::map SpatialPositionedIndex;
> +
>  class LowerLimitOfType
>  {
>  public:
> @@ -67,11 +70,16 @@
>{
>  return a < b->type();
>}
> +#if defined(_MSC_VER) && defined(_DEBUG)
> +  bool operator()(const FGPositioned* a, const FGPositioned* b) const
> +  {
> + return a->type() < b->type();
> +  }
> +#endif
>  };
>  
>  
> -typedef std::set BucketEntry;
> -typedef std::map SpatialPositionedIndex;
> +
>  
>  static NamedPositionedIndex global_namedIndex;
>  static SpatialPositionedIndex global_spatialIndex;
> 
> 
> 
> 
> 
> __
> 网易邮箱,中国第一大电子邮件服务商
> --
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> ___ Flightgear-devel mailing list 
> Flightgear-devel@lists.sourceforge.net 
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel


--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


[Flightgear-devel] Patch for positioned.cxx

2009-02-21 Thread 黄志勇
Hi,
Compiling the file positioned.cxx with MSVC in debug model, it have some 
problems.
but in release model , it have not.
I think that it is the problem of implementation of STL by Microsoft in debug 
model.
So i add a method for class LowerLimitOfType, and it works.
I'd be happy if someone considers commiting this.

Thanks, ZhiYong Huang


Index: positioned.cxx
===
RCS file: /var/cvs/FlightGear-0.9/source/src/Navaids/positioned.cxx,v
retrieving revision 1.12
diff -u -r1.12 positioned.cxx
--- positioned.cxx   9 Jan 2009 13:15:03 -   1.12
+++ positioned.cxx   21 Feb 2009 17:54:27 -
@@ -55,6 +55,9 @@
   }
 };
 
+typedef std::set BucketEntry;
+typedef std::map SpatialPositionedIndex;
+
 class LowerLimitOfType
 {
 public:
@@ -67,11 +70,16 @@
   {
 return a < b->type();
   }
+#if defined(_MSC_VER) && defined(_DEBUG)
+  bool operator()(const FGPositioned* a, const FGPositioned* b) const
+  {
+ return a->type() < b->type();
+  }
+#endif
 };
 
 
-typedef std::set BucketEntry;
-typedef std::map SpatialPositionedIndex;
+
 
 static NamedPositionedIndex global_namedIndex;
 static SpatialPositionedIndex global_spatialIndex;

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Patch for positioned.cxx

2009-02-20 Thread Frederic Bouvier
- "黄志勇" a écrit :

> Sorry, in Microsoft Windows, there have not patch tool. I just can do
> like this.

If you use cvs :

cvs diff -u my_file.cxx

Or use TortoiseCVS to do the diff

-Fred

-- 
Frédéric Bouvier
http://my.fotolia.com/frfoto/  Photo gallery - album photo
http://fgsd.sourceforge.net/   FlightGear Scenery Designer


--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


[Flightgear-devel] Patch for positioned.cxx

2009-02-20 Thread 黄志勇
When compiling source code with MSVC 2005 in debug model, below two rows have 
some problem.
=== two rows have problem ===
l = lower_bound(it->second.begin(), it->second.end(), aFilter->minType(), 
LowerLimitOfType());
u = upper_bound(l, it->second.end(), aFilter->maxType(), 
LowerLimitOfType());
 
=== error info reported by MSVC compiler =
c:\program files\microsoft visual studio 8\vc\include\xutility(290) : error 
C2664: 'bool LowerLimitOfType::operator ()(const FGPositioned::Type,const 
FGPositioned *) const' : cannot convert parameter 1 from 'FGPositioned *const ' 
to 'const FGPositioned::Type'
 
=== Patch for this problem 
1) move definitions of "BucketEntry" and "SpatialPositionedIndex" to before of 
the definition of class "LowerLimitOfType"
2) add method like below for class "LowerLimitOfType"
+ #if defined(_MSC_VER) && defined(_DEBUG)
+  bool operator()(const FGPositioned* a, const FGPositioned* b) const
+  {
+   return a->type() < b->type();
+  }
+ #endif
 
Sorry, in Microsoft Windows, there have not patch tool. I just can do like this.
 
Huang.
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel