diff --git a/applications/test/limits/Test-limits.C b/applications/test/limits/Test-limits.C
new file mode 100644
index 0000000000000000000000000000000000000000..4123d475d824cb52e9c5fc5ce6f4749f9e3657cf
--- /dev/null
+++ b/applications/test/limits/Test-limits.C
@@ -0,0 +1,63 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2018 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Description
+    Print max limits.
+
+\*---------------------------------------------------------------------------*/
+
+#include <limits>
+#include "int.H"
+#include "uint.H"
+#include "string.H"
+#include "IOstreams.H"
+
+using namespace Foam;
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// Main program:
+
+int main(int argc, char *argv[])
+{
+    //NONE Info<<"int16:" << pTraits<int16_t>::max << nl;
+    Info<<"int16:" << std::numeric_limits<int16_t>::max() << nl;
+    Info<<"int32:" << pTraits<int32_t>::max << nl;
+    Info<<"int64:" << pTraits<int64_t>::max << nl;
+    Info<<"uint32:" << pTraits<uint32_t>::max << nl;
+    Info<<"uint64:" << pTraits<uint64_t>::max << nl;
+
+    Info<< nl;
+
+    cout<<"int16:" << std::numeric_limits<int16_t>::max() << nl;
+    cout<<"int32:" << pTraits<int32_t>::max << nl;
+    cout<<"int64:" << pTraits<int64_t>::max << nl;
+    cout<<"uint32:" << pTraits<uint32_t>::max << nl;
+    cout<<"uint64:" << pTraits<uint64_t>::max << nl;
+
+    Info << "---\nEnd\n" << endl;
+
+    return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/test/machine-sizes/Make/files b/applications/test/machine-sizes/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..15c18ac321030ae4bdad1df13b4ccbc5dfd40ce4
--- /dev/null
+++ b/applications/test/machine-sizes/Make/files
@@ -0,0 +1,3 @@
+Test-machine-sizes.cpp
+
+EXE = $(FOAM_USER_APPBIN)/Test-machine-sizes
diff --git a/applications/test/machine-sizes/Make/options b/applications/test/machine-sizes/Make/options
new file mode 100644
index 0000000000000000000000000000000000000000..18e6fe47afacb902cddccf82632772447704fd88
--- /dev/null
+++ b/applications/test/machine-sizes/Make/options
@@ -0,0 +1,2 @@
+/* EXE_INC = */
+/* EXE_LIBS = */
diff --git a/applications/test/machine-sizes/Test-machine-sizes.cpp b/applications/test/machine-sizes/Test-machine-sizes.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..784fcfbca851b498160744e0188df7fd6cbedd9f
--- /dev/null
+++ b/applications/test/machine-sizes/Test-machine-sizes.cpp
@@ -0,0 +1,112 @@
+/*---------------------------------------------------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 2018 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+Description
+    Test the sizeof for basic types. Can be compiled and run without
+    any OpenFOAM libraries.
+
+\*---------------------------------------------------------------------------*/
+
+#include <cstdint>
+#include <climits>
+#include <cstdlib>
+#include <limits>
+#include <iostream>
+
+// Can also compile without OpenFOAM
+#ifdef WM_LABEL_SIZE
+    #include "IOstreams.H"
+#endif
+
+template<class T>
+void print(const char* msg)
+{
+    std::cout<< msg << ' ' << sizeof(T) << '\n';
+}
+
+
+#ifdef WM_LABEL_SIZE
+template<class T>
+void printMax(const char* msg)
+{
+    std::cout<< msg << ' ' << sizeof(T)
+        << " max "
+        << std::numeric_limits<T>::max() << '\n';
+
+    Foam::Info<< msg << ' ' << sizeof(T)
+        << " max "
+        << long(std::numeric_limits<T>::max()) << '\n';
+}
+#endif
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// Main program:
+
+int main(int argc, char *argv[])
+{
+    std::cout<<"machine sizes\n---\n\n";
+
+    print<mode_t>("mode_t");
+    print<short>("short");
+    print<int>("int");
+    print<long>("long");
+    print<long long>("long long");
+    print<unsigned short>("ushort");
+    print<unsigned int>("uint");
+    print<unsigned long>("ulong");
+    print<unsigned long long>("ulong-long");
+    print<int16_t>("int16");
+    print<int32_t>("int32");
+    print<int64_t>("int64");
+    print<uint16_t>("uint16");
+    print<uint32_t>("uint32");
+    print<uint64_t>("uint64");
+    print<float>("float");
+    print<double>("double");
+    print<std::string>("std::string");
+    print<std::string::size_type>("std::string::size_type");
+
+    #ifdef WM_LABEL_SIZE
+    std::cout<<"\nmax values\n---\n\n";
+
+    printMax<mode_t>("mode_t");
+    Foam::Info<< "mode_t 0777: " << mode_t(0777) << '\n';
+
+    printMax<short>("short");
+    printMax<int>("int");
+    printMax<long>("long");
+    printMax<unsigned short>("ushort");
+    printMax<unsigned int>("uint");
+    printMax<unsigned long>("ulong");
+    printMax<float>("float");
+    printMax<double>("double");
+    #endif
+
+    std::cout << "\n---\nEnd\n\n";
+
+    return 0;
+}
+
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/Scalar/Scalar.H b/src/OpenFOAM/primitives/Scalar/Scalar.H
index e351068785a91173cf6c1d7166e20fb2af61aa8d..f091f427650ae9aaba02d3535a7833319be208a0 100644
--- a/src/OpenFOAM/primitives/Scalar/Scalar.H
+++ b/src/OpenFOAM/primitives/Scalar/Scalar.H
@@ -89,13 +89,13 @@ public:
 
     // Member Functions
 
-        //- Access to the Scalar value
+        //- Access to the value
         operator Scalar() const
         {
             return p_;
         }
 
-        //- Access to the Scalar value
+        //- Access to the value
         operator Scalar&()
         {
             return p_;
diff --git a/src/OpenFOAM/primitives/bools/bool/bool.H b/src/OpenFOAM/primitives/bools/bool/bool.H
index 55ac2cfbff4ba03806680681dca62650810e9c36..9d413995f3ff4e2b3b0f148a0757bd57693d1d76 100644
--- a/src/OpenFOAM/primitives/bools/bool/bool.H
+++ b/src/OpenFOAM/primitives/bools/bool/bool.H
@@ -103,13 +103,13 @@ public:
 
     // Member Functions
 
-        //- Access to the bool value
+        //- Access to the value
         operator bool() const
         {
             return p_;
         }
 
-        //- Access to the bool value
+        //- Access to the value
         operator bool&()
         {
             return p_;
diff --git a/src/OpenFOAM/primitives/ints/int32/int32.H b/src/OpenFOAM/primitives/ints/int32/int32.H
index 497e7b8b5ef5c41aebf519bb6f234114bc12e37b..2d4910a1599f9fe91c3eb8db50de4d7f900d565d 100644
--- a/src/OpenFOAM/primitives/ints/int32/int32.H
+++ b/src/OpenFOAM/primitives/ints/int32/int32.H
@@ -107,9 +107,8 @@ inline bool read(const std::string& str, int32_t& val)
 Istream& operator>>(Istream& is, int32_t& val);
 Ostream& operator<<(Ostream& os, const int32_t val);
 
-// On 32bit OSs long is not unambiguously int32_t (or int64_t) causing problems
-// for IO operator resolution.
-// This problem is avoided by explicitly defining the following operators:
+// 32bit OS: long is not unambiguously (int32_t | int64_t)
+// - resolve explicitly for input and output
 #if WM_ARCH_OPTION == 32
     Istream& operator>>(Istream& is, long& val);
     Ostream& operator<<(Ostream& os, const long val);
@@ -163,13 +162,13 @@ public:
 
     // Member Functions
 
-        //- Access to the int32_t value
+        //- Access to the value
         operator int32_t() const
         {
             return p_;
         }
 
-        //- Access to the int value
+        //- Access to the value
         operator int32_t&()
         {
             return p_;
diff --git a/src/OpenFOAM/primitives/ints/int64/int64.H b/src/OpenFOAM/primitives/ints/int64/int64.H
index c6d097c437c9d6243fb36ef02e122411222fdd6a..36dce6ee04bc1e47d329ddb781aa6b5c86ea2a09 100644
--- a/src/OpenFOAM/primitives/ints/int64/int64.H
+++ b/src/OpenFOAM/primitives/ints/int64/int64.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2014-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2016-2017 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2016-2018 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -108,6 +108,13 @@ inline bool read(const std::string& str, int64_t& val)
 Istream& operator>>(Istream& is, int64_t& val);
 Ostream& operator<<(Ostream& os, const int64_t val);
 
+// On Darwin: long is not unambiguously (int32_t | int64_t)
+// - explicitly resolve for output
+#if WM_ARCH_OPTION == 64 && defined(darwin)
+    Ostream& operator<<(Ostream& os, const long val);
+#endif
+
+
 //- Template specialization for pTraits<int64_t>
 template<>
 class pTraits<int64_t>
@@ -155,13 +162,13 @@ public:
 
     // Member Functions
 
-        //- Access to the int64_t value
+        //- Access to the value
         operator int64_t() const
         {
             return p_;
         }
 
-        //- Access to the int value
+        //- Access to the value
         operator int64_t&()
         {
             return p_;
diff --git a/src/OpenFOAM/primitives/ints/int64/int64IO.C b/src/OpenFOAM/primitives/ints/int64/int64IO.C
index 1a2ad639e3f0d01ac795066564eece5846b5fb8a..bb0c08e1e0ba6ffb45c4f18c1de29bd0ee5decb3 100644
--- a/src/OpenFOAM/primitives/ints/int64/int64IO.C
+++ b/src/OpenFOAM/primitives/ints/int64/int64IO.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2014-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2017-2018 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -120,4 +120,13 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const int64_t val)
 }
 
 
+#if WM_ARCH_OPTION == 64 && defined(darwin)
+Foam::Ostream& Foam::operator<<(Ostream& os, const long val)
+{
+    os << int64_t(val);
+    return os;
+}
+#endif
+
+
 // ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/ints/uint32/uint32.H b/src/OpenFOAM/primitives/ints/uint32/uint32.H
index 8841d878f712b3eac0ea6aa7b92a64e5b7aa5311..94e3c13598bf86d0393361dc25167e46adde6343 100644
--- a/src/OpenFOAM/primitives/ints/uint32/uint32.H
+++ b/src/OpenFOAM/primitives/ints/uint32/uint32.H
@@ -154,13 +154,13 @@ public:
 
     // Member Functions
 
-        //- Access to the uint32_t value
+        //- Access to the value
         operator uint32_t() const
         {
             return p_;
         }
 
-        //- Access to the uint32_t value
+        //- Access to the value
         operator uint32_t&()
         {
             return p_;
diff --git a/src/OpenFOAM/primitives/ints/uint64/uint64.H b/src/OpenFOAM/primitives/ints/uint64/uint64.H
index 7c63a695c316fe3fd42e75c2c7641d570926a470..8bc75023f1cf7b93801c9fd2142783505b4d31d0 100644
--- a/src/OpenFOAM/primitives/ints/uint64/uint64.H
+++ b/src/OpenFOAM/primitives/ints/uint64/uint64.H
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2014-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2016-2017 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2016-2018 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -107,6 +107,13 @@ inline bool read(const std::string& str, uint64_t& val)
 Istream& operator>>(Istream& is, uint64_t& val);
 Ostream& operator<<(Ostream& os, const uint64_t val);
 
+// On Darwin: unsigned long is not unambiguously (uint32_t | uint64_t)
+// - explicitly resolve for output
+#if WM_ARCH_OPTION == 64 && defined(darwin)
+    Ostream& operator<<(Ostream& os, const unsigned long val);
+#endif
+
+
 //- Template specialization for pTraits<uint64_t>
 template<>
 class pTraits<uint64_t>
@@ -154,13 +161,13 @@ public:
 
     // Member Functions
 
-        //- Access to the uint64_t value
+        //- Access to the value
         operator uint64_t() const
         {
             return p_;
         }
 
-        //- Access to the uint64_t value
+        //- Access to the value
         operator uint64_t&()
         {
             return p_;
diff --git a/src/OpenFOAM/primitives/ints/uint64/uint64IO.C b/src/OpenFOAM/primitives/ints/uint64/uint64IO.C
index b73e90e7714c47a777909ddc6214155ecf56f8f2..1fb0f5adaff3025800b81d93a91a20db6a5a4792 100644
--- a/src/OpenFOAM/primitives/ints/uint64/uint64IO.C
+++ b/src/OpenFOAM/primitives/ints/uint64/uint64IO.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2014-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2017-2018 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -119,4 +119,13 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const uint64_t val)
 }
 
 
+#if WM_ARCH_OPTION == 64 && defined(darwin)
+Foam::Ostream& Foam::operator<<(Ostream& os, const unsigned long val)
+{
+    os << uint64_t(val);
+    return os;
+}
+#endif
+
+
 // ************************************************************************* //