RE: [Flightgear-devel] Error in SGMisc class? I don't see it ...

2006-02-27 Thread Jon S. Berndt
  Here's the offensive code in /usr/local/include/simgear/math/SGMisc.hxx
 
  === start ===
 
static T min(const T a, const T b)
 
  === end ===
 
  The last line, above, is the culprit. As before, the errors are:
 
  SGMisc.hxx:28: error: expected unqualified-id before const
  SGMisc.hxx:28: error: expected `)' before const
  SGMisc.hxx:28: error: expected `)' before const
 
  The rest of the errors (lots of them), likewise involve min.
 
  Jon
 
 It is a handy and typesafe way to program a min or max function.
 You know exactly what type the input arguments are and which the output
 arguments are.

 ...

 What brakes, but that brakes anyway if you do includes in the
 wrong order, is
 that a prevously defined min/max macro will disturb the
 declaration/implementation of the SGMisc min/max as it would
 disturb that for
 every other min/max declaration/implementation like the std::min/std::max
 functions for example too.

 I bet that you defined such a macro and past that include SGMath.h

   Mathias

I know what the min() template definition does - and it looks like a really
good idea.

However, the code from plib, simgear, and flightgear is all straight from
CVS. I looked at the tests/ subdirectory and examined the headers. I renamed
the JSBSim subdirectory. The test-up code still won't compile, and gives the
same error. Again - this is straight from CVS. Some of the other code in
test-up/ does compile. I'm working under CygWin, but I don't think this
should have any effect.

Jon





---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


RE: [Flightgear-devel] Error in SGMisc class? I don't see it ...

2006-02-27 Thread Norman Vine
You need to make sure to #define NOMINMAX

or else windows.h includes conflicting stuff

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Jon S.
 Berndt
 Sent: Monday, February 27, 2006 7:57 AM
 To: flightgear-devel@lists.sourceforge.net
 Subject: RE: [Flightgear-devel] Error in SGMisc class? I don't see it
 ...
 
 
   Here's the offensive code in /usr/local/include/simgear/math/SGMisc.hxx
  
   === start ===
  
 static T min(const T a, const T b)
  
   === end ===
  
   The last line, above, is the culprit. As before, the errors are:
  
   SGMisc.hxx:28: error: expected unqualified-id before const
   SGMisc.hxx:28: error: expected `)' before const
   SGMisc.hxx:28: error: expected `)' before const
  
   The rest of the errors (lots of them), likewise involve min.
  
   Jon
  
  It is a handy and typesafe way to program a min or max function.
  You know exactly what type the input arguments are and which the output
  arguments are.
 
  ...
 
  What brakes, but that brakes anyway if you do includes in the
  wrong order, is
  that a prevously defined min/max macro will disturb the
  declaration/implementation of the SGMisc min/max as it would
  disturb that for
  every other min/max declaration/implementation like the std::min/std::max
  functions for example too.
 
  I bet that you defined such a macro and past that include SGMath.h
 
Mathias
 
 I know what the min() template definition does - and it looks like a really
 good idea.
 
 However, the code from plib, simgear, and flightgear is all straight from
 CVS. I looked at the tests/ subdirectory and examined the headers. I renamed
 the JSBSim subdirectory. The test-up code still won't compile, and gives the
 same error. Again - this is straight from CVS. Some of the other code in
 test-up/ does compile. I'm working under CygWin, but I don't think this
 should have any effect.
 
 Jon
 
 
 
 
 
 ---
 This SF.Net email is sponsored by xPML, a groundbreaking scripting language
 that extends applications into web and mobile media. Attend the live webcast
 and join the prime developer group breaking into this new coding territory!
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
 ___
 Flightgear-devel mailing list
 Flightgear-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/flightgear-devel
 


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Error in SGMisc class? I don't see it ...

2006-02-26 Thread Mathias Fröhlich
On Monday 27 February 2006 04:44, Jon S. Berndt wrote:
  Stupid me. I worded the problem incorrectly. Obviously, the
  problem is with
  a compile of the FlightGear test program, with the definition or use of
  min.

 Here's the offensive code in /usr/local/include/simgear/math/SGMisc.hxx

 === start ===

 #ifndef SGMisc_H
 #define SGMisc_H

 #include cmath

 templatetypename T
 class SGMisc {
 public:
   static T pi() { return T(3.1415926535897932384626433832795029L); }
   static T min(const T a, const T b)

 === end ===

 The last line, above, is the culprit. As before, the errors are:

 SGMisc.hxx:28: error: expected unqualified-id before const
 SGMisc.hxx:28: error: expected `)' before const
 SGMisc.hxx:28: error: expected `)' before const

 The rest of the errors (lots of them), likewise involve min.

 Jon

 P.S. What is the test-up application, anyhow? Can we avoid compiling that?
 Or, is it needed?

Yes it is needed and used.

It is a handy and typesafe way to program a min or max function.
You know exactly what type the input arguments are and which the output 
arguments are.

What you can do when you want a float max is

SFMiscfloat::max(b, a)

You don't get ambiguities and you dont get whatever min/max is defined in the 
global namespace you dont know about which types are used when it is really 
defined.

What brakes, but that brakes anyway if you do includes in the wrong order, is 
that a prevously defined min/max macro will disturb the 
declaration/implementation of the SGMisc min/max as it would disturb that for 
every other min/max declaration/implementation like the std::min/std::max 
functions for example too.

I bet that you defined such a macro and past that include SGMath.h

Greetings

  Mathias



-- 
Mathias Fröhlich, email: [EMAIL PROTECTED]


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid0944bid$1720dat1642
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel