View Issue Details

IDProjectCategoryView StatusLast Update
0002152OpenFOAMPatchpublic2016-07-15 11:46
Reporterwyldckat Assigned Tohenry  
PrioritynormalSeveritymajorReproducibilitysometimes
Status resolvedResolutionfixed 
Product Versiondev 
Fixed in Versiondev 
Summary0002152: "uint.H" has an inconsistent definition, when cross-checking with "uintIO.C"
DescriptionThe file "src/OpenFOAM/primitives/ints/uint/uint.H" has this declaration:

  uint readUint(Istream&);

while "uintIO.C" defines it as:

  unsigned int Foam::readUint(Istream& is)


This is an inconsistency, given that some systems will either not have a definition for "uint" or may have another different definition from "unsigned int".

Attached is the file that fixes this in "uint.H", by using "unsigned int" instead of "uint".
Additional InformationThis is a bit bias on my part, given that I'm currently working on porting the OpenFOAM-dev master branch to Windows and "uint" is undefined with the standard definitions that are inherited from "uint32.H" in the current stack that I'm using.

Nonetheless, an explicit usage of "unsigned int" makes a bit more sense, in case there are more systems that simply don't have "uint" defined or have a simply have a different definition.
TagsNo tags attached.

Activities

wyldckat

2016-07-15 11:16

updater  

uint.H (2,555 bytes)   
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
     \\/     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/>.

Primitive
    uint

Description
    System uinteger

SourceFiles
    uintIO.C

\*---------------------------------------------------------------------------*/

#ifndef uint_H
#define uint_H

#include "uint32.H"
#include "uint64.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

#define MAXMIN(retType, type1, type2)              \
                                                   \
inline retType max(const type1 s1, const type2 s2) \
{                                                  \
    return (s1 > s2)? s1: s2;                      \
}                                                  \
                                                   \
inline retType min(const type1 s1, const type2 s2) \
{                                                  \
    return (s1 < s2)? s1: s2;                      \
}


MAXMIN(uint8_t, uint8_t, uint8_t)
MAXMIN(uint16_t, uint16_t, uint16_t)

MAXMIN(uint32_t, uint32_t, uint32_t)
MAXMIN(uint64_t, uint64_t, uint32_t)
MAXMIN(uint64_t, uint32_t, uint64_t)
MAXMIN(uint64_t, uint64_t, uint64_t)


// * * * * * * * * * * * * * * * IOstream Operators  * * * * * * * * * * * * //

unsigned int readUint(Istream&);


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //
uint.H (2,555 bytes)   

henry

2016-07-15 11:46

manager   ~0006531

Resolved by commit f4a588d421348a8cfb5a744e71d604e1661b5194

Issue History

Date Modified Username Field Change
2016-07-15 11:16 wyldckat New Issue
2016-07-15 11:16 wyldckat Status new => assigned
2016-07-15 11:16 wyldckat Assigned To => henry
2016-07-15 11:16 wyldckat File Added: uint.H
2016-07-15 11:46 henry Note Added: 0006531
2016-07-15 11:46 henry Status assigned => resolved
2016-07-15 11:46 henry Fixed in Version => dev
2016-07-15 11:46 henry Resolution open => fixed