Patch for filib++ of March 15, 2002

24 Mar
2002
24 Mar
'02
4:42 p.m.
Dear German,
please find enclosed a patch relative to the version of filib++ of March 15, 2002. The changes I had to make concern the presence of
using namespace std;
in some filib++ header files. The patch enclosed just removes them and adds explicit qualifications where needed. In general, using directives should be avoided in public include files because there is no way for the user to withdraw them (see http://www.gotw.ca/gotw/053.htm for a discussion of this point). In my particular case, the presence of that directive made compilation of my compilation impossible, since I have to include header files from other libraries and the presence of the "using namespace std" clashes. Keep up the good work
Roberto
--
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara@cs.unipr.it
Index: macro/include/Interval.h
===================================================================
RCS file: /cvs/filib++/interval/macro/include/Interval.h,v
retrieving revision 1.1.1.2
diff -c -d -r1.1.1.2 Interval.h
*** macro/include/Interval.h 15 Feb 2002 14:36:25 -0000 1.1.1.2
--- macro/include/Interval.h 24 Mar 2002 16:38:11 -0000
***************
*** 6,12 ****
#ifdef FILIB_STD_HEADERS
#include <iosfwd>
#include <algorithm> // min, max
- using namespace std;
#else
#include <iostream.h>
--- 6,11 ----
***************
*** 1381,1387 ****
*
* @see #precision
*/
! friend ostream &operator <<(ostream &os, INTV_ARG x);
/**
* Reads an interval in decimal representation from the given input stream.
--- 1380,1386 ----
*
* @see #precision
*/
! friend std::ostream &operator <<(std::ostream &os, INTV_ARG x);
/**
* Reads an interval in decimal representation from the given input stream.
***************
*** 1400,1412 ****
*
* Special intervals in the extended system are not yet considered.
*/
! friend istream &operator >>(istream &is, Interval &x);
/**
* Prints a binary representation of this interval to the given output
* stream.
*/
! void bitImage(ostream &os) const;
// -----------------------------------------------------------------------
// Special numbers
--- 1399,1411 ----
*
* Special intervals in the extended system are not yet considered.
*/
! friend std::istream &operator >>(std::istream &is, Interval &x);
/**
* Prints a binary representation of this interval to the given output
* stream.
*/
! void bitImage(std::ostream &os) const;
// -----------------------------------------------------------------------
// Special numbers
Index: macro/include/Interval.icc
===================================================================
RCS file: /cvs/filib++/interval/macro/include/Interval.icc,v
retrieving revision 1.1.1.1
diff -c -d -r1.1.1.1 Interval.icc
*** macro/include/Interval.icc 15 Feb 2002 14:35:52 -0000 1.1.1.1
--- macro/include/Interval.icc 24 Mar 2002 16:38:12 -0000
***************
*** 282,288 ****
if (contains(0.0))
return 0.0;
else
! return min(Double::abs(INF), Double::abs(SUP));
}
--- 282,288 ----
if (contains(0.0))
return 0.0;
else
! return std::min(Double::abs(INF), Double::abs(SUP));
}
***************
*** 296,302 ****
FILIB_INLINE
double Interval::mag() const
{
! return max(Double::abs(INF), Double::abs(SUP));
}
--- 296,302 ----
FILIB_INLINE
double Interval::mag() const
{
! return std::max(Double::abs(INF), Double::abs(SUP));
}
***************
*** 331,337 ****
return *this;
else
#endif
! return Interval(min(INF, x.INF), min(SUP, x.SUP));
}
--- 331,337 ----
return *this;
else
#endif
! return Interval(std::min(INF, x.INF), std::min(SUP, x.SUP));
}
***************
*** 352,358 ****
return *this;
else
#endif
! return Interval(max(INF, x.INF), max(SUP, x.SUP));
}
--- 352,358 ----
return *this;
else
#endif
! return Interval(std::max(INF, x.INF), std::max(SUP, x.SUP));
}
***************
*** 385,394 ****
SUB_UP(tmp1, INF, x.INF);
SUB_UP(tmp2, SUP, x.SUP);
POSS_ROUND_NEAR;
! res = max(Double::abs(tmp1), Double::abs(tmp2));
#else
! res = max(Double::succ(Double::abs(INF == x.INF ? 0.0 : INF-x.INF)),
! Double::succ(Double::abs(SUP == x.SUP ? 0.0 : SUP-x.SUP)));
#endif
#ifdef FILIB_EXTENDED
--- 385,394 ----
SUB_UP(tmp1, INF, x.INF);
SUB_UP(tmp2, SUP, x.SUP);
POSS_ROUND_NEAR;
! res = std::max(Double::abs(tmp1), Double::abs(tmp2));
#else
! res = std::max(Double::succ(Double::abs(INF == x.INF ? 0.0 : INF-x.INF)),
! Double::succ(Double::abs(SUP == x.SUP ? 0.0 : SUP-x.SUP)));
#endif
#ifdef FILIB_EXTENDED
***************
*** 438,444 ****
return errorIntersect(*this, x);
#endif
! return Interval(max(INF, x.INF), min(SUP, x.SUP));
}
--- 438,444 ----
return errorIntersect(*this, x);
#endif
! return Interval(std::max(INF, x.INF), std::min(SUP, x.SUP));
}
***************
*** 459,465 ****
return *this;
else
#endif
! return Interval(min(INF, x.INF), max(SUP, x.SUP));
}
--- 459,465 ----
return *this;
else
#endif
! return Interval(std::min(INF, x.INF), std::max(SUP, x.SUP));
}
***************
*** 480,486 ****
return *this;
else
#endif
! return Interval(min(INF, x), max(SUP, x));
}
--- 480,486 ----
return *this;
else
#endif
! return Interval(std::min(INF, x), std::max(SUP, x));
}
Index: macro/include/global.h
===================================================================
RCS file: /cvs/filib++/interval/macro/include/global.h,v
retrieving revision 1.1.1.1
diff -c -d -r1.1.1.1 global.h
*** macro/include/global.h 15 Feb 2002 14:35:53 -0000 1.1.1.1
--- macro/include/global.h 24 Mar 2002 16:38:12 -0000
***************
*** 35,41 ****
#ifdef FILIB_STD_HEADERS
#include <cmath>
- using namespace std;
#else
#include <math.h>
#endif
--- 35,40 ----
Index: macro/include/ieee.h
===================================================================
RCS file: /cvs/filib++/interval/macro/include/ieee.h,v
retrieving revision 1.1.1.1
diff -c -d -r1.1.1.1 ieee.h
*** macro/include/ieee.h 15 Feb 2002 14:35:53 -0000 1.1.1.1
--- macro/include/ieee.h 24 Mar 2002 16:38:12 -0000
***************
*** 12,18 ****
#ifdef FILIB_STD_HEADERS
#include <iosfwd>
- using namespace std;
#else
#include <iostream.h>
#endif
--- 12,17 ----
***************
*** 174,181 ****
// -----------------------------------------------------------------------
// I/O
// -----------------------------------------------------------------------
! static void print(double x, ostream &os);
! static void bitImage(double x, ostream &os);
// -----------------------------------------------------------------------
// predecessor and successor of a number
--- 173,180 ----
// -----------------------------------------------------------------------
// I/O
// -----------------------------------------------------------------------
! static void print(double x, std::ostream &os);
! static void bitImage(double x, std::ostream &os);
// -----------------------------------------------------------------------
// predecessor and successor of a number
***************
*** 374,380 ****
static FPUStartUp startup;
! static void basicBitImage(double d, ostream &os);
// -----------------------------------------------------------------------
// pred/succ stuff
--- 373,379 ----
static FPUStartUp startup;
! static void basicBitImage(double d, std::ostream &os);
// -----------------------------------------------------------------------
// pred/succ stuff
8444
Age (days ago)
8444
Last active (days ago)
0 comments
1 participants
participants (1)
-
Roberto Bagnara