Skip to content

Commit 54c5d5d

Browse files
committed
c++: port to Sun C++ 5.12
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.
1 parent 693e69f commit 54c5d5d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

data/skeletons/location.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ m4_define([b4_location_define],
113113
/// Compute max (min, lhs+rhs).
114114
static int add_ (int lhs, int rhs, int min)
115115
{
116-
return std::max (min, lhs + rhs);
116+
return lhs + rhs < min ? min : lhs + rhs;
117117
}
118118
};
119119

@@ -345,7 +345,6 @@ m4_ifdef([b4_location_file], [[
345345

346346
]b4_cpp_guard_open([b4_location_path])[
347347

348-
# include <algorithm> // std::max
349348
# include <iostream>
350349
# include <string>
351350

0 commit comments

Comments
 (0)