Skip to content

Commit

Permalink
c++: port to Sun C++ 5.12
Browse files Browse the repository at this point in the history
The documentation for Oracle Solaris Studio 12.3 (Sun C++ 5.12
2011/11/16) says it supports C++03.  This compiler rejects the
location.cc use of std::max for some reason; I don’t know why
since I don’t use C++ as a rule.  The simplest workaround is to
open-code ‘max’.
* data/skeletons/location.cc (add_):
Do max by hand rather than relying on std::max.
Don’t include <algorithm.h>; no longer needed.
  • Loading branch information
eggert committed Oct 17, 2019
1 parent 693e69f commit 54c5d5d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions data/skeletons/location.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ m4_define([b4_location_define],
/// Compute max (min, lhs+rhs).
static int add_ (int lhs, int rhs, int min)
{
return std::max (min, lhs + rhs);
return lhs + rhs < min ? min : lhs + rhs;
}
};

Expand Down Expand Up @@ -345,7 +345,6 @@ m4_ifdef([b4_location_file], [[

]b4_cpp_guard_open([b4_location_path])[

# include <algorithm> // std::max
# include <iostream>
# include <string>

Expand Down

0 comments on commit 54c5d5d

Please sign in to comment.