View Issue Details

IDProjectCategoryView StatusLast Update
0003549OpenFOAMPatchpublic2020-09-18 13:32
ReporterwyldckatAssigned Tohenry 
PrioritylowSeverityminorReproducibilitysometimes
Status resolvedResolutionfixed 
Product Versiondev 
Fixed in Versiondev 
Summary0003549: 'uint' used in TimeIO.C instead of 'unsigned int'
DescriptionIn the file 'src/OpenFOAM/db/Time/TimeIO.C' is being used the 'uint' type here:

         IOstream::defaultPrecision
         (
            controlDict_.lookup<uint>("writePrecision")
         );

However, 'IOstream::defaultPrecision' is defined as 'unsigned int', as visible here: https://github.com/OpenFOAM/OpenFOAM-dev/blob/def4772281a87a24de61057d4e4a68a7cf2248d9/src/OpenFOAM/db/IOstreams/IOstreams/IOstream.H#L210

           //- Default precision
        static unsigned int precision_;

This does not cause a problem in the majority of compilation environments, given that 'uint' is defined as 'unsigned int' in most cases, but this past week I tripped over this not being a default on all environments, namely while compiling on Windows with GCC+MinGW-w64.

Attached are the following files to change 'uint' to 'unsigned int' in 'TimeIO.C', given that it seems to be the only situation where it's being used in the OpenFOAM library:

  - TimeIO.C - for replacing the one in OpenFOAM-dev (commit c4f98e7835ce, Sep 17 10:51:29 2020), at 'src/OpenFOAM/db/Time/TimeIO.C'

  - patch_uint_v1.patch - shows the proposed patch
TagsNo tags attached.

Activities

wyldckat

2020-09-18 13:15

updater  

patch_uint_v1.patch (470 bytes)
diff --git a/src/OpenFOAM/db/Time/TimeIO.C b/src/OpenFOAM/db/Time/TimeIO.C
index 5eb5d00..7bdab8a 100644
--- a/src/OpenFOAM/db/Time/TimeIO.C
+++ b/src/OpenFOAM/db/Time/TimeIO.C
@@ -345,7 +345,7 @@ void Foam::Time::readDict()
     {
         IOstream::defaultPrecision
         (
-            controlDict_.lookup<uint>("writePrecision")
+            controlDict_.lookup<unsigned int>("writePrecision")
         );
 
         Sout.precision(IOstream::defaultPrecision());
patch_uint_v1.patch (470 bytes)
TimeIO.C (14,742 bytes)

henry

2020-09-18 13:32

manager   ~0011514

Resolved by commit 07f6ffa2b8d88ed3d5da8cdf7763aeccab5d7b29

Issue History

Date Modified Username Field Change
2020-09-18 13:15 wyldckat New Issue
2020-09-18 13:15 wyldckat File Added: patch_uint_v1.patch
2020-09-18 13:15 wyldckat File Added: TimeIO.C
2020-09-18 13:32 henry Assigned To => henry
2020-09-18 13:32 henry Status new => resolved
2020-09-18 13:32 henry Resolution open => fixed
2020-09-18 13:32 henry Fixed in Version => dev
2020-09-18 13:32 henry Note Added: 0011514