Compiler Warnings on VS2005

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
ofek
Posts: 5
Joined: Wed, 2007-07-18, 10:56
Contact:

Compiler Warnings on VS2005

#1 Post by ofek »

Hi.

while compiling an app that links to dcmtk 3.5.4 (with warning level set to 4), i get the casting warnings.


For the dcmtk source:

Code: Select all

int numberOfRepeatingTagEntries() const { return repDict.size(); }
Or:

Code: Select all

   inline Uint32 getCount() const
    {
        return List.size();
    }

i get:
warning C4267: 'return' : conversion from 'size_t' to 'int'/'Uint32', possible loss of data.


While not a major issue, and i can technically disable the warnings at the calling site - why not cleanup dcmtk, and return size_t at the source?

thanks,

Ofek

Michael Onken
DCMTK Developer
Posts: 2052
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#2 Post by Michael Onken »

Hi Ofek,

thank you for the hint. We always try to keep all compilers quiet during compilation; in earlier times we did that mainly when preparing a realease (*sigh*), so, at the moment we do only fix warnings occassionally.

For the warning you reported, a fix was already applied a few months ago, the code now reads:

Code: Select all

    /// returns the number of repeating tag entries
    int numberOfRepeatingTagEntries() const { return OFstatic_cast(int, repDict.size()); }
...which maybe is only the second best solution. You can download the latest snapshots of DCMTK here. Snapshots usually are quite stable, but we did not compile them on uncommon systems like Irix, AIX and so on...

There are a number of other warnings because of the introduction of the OFFile class that was mainly introduced for large file support and should now be used instead of a FILE pointer. We're going to fix those warnings too, somewhen when time permits (it implicates changes to some more files and code so it cannot be done in a minute).

Regards,
Michael

ofek
Posts: 5
Joined: Wed, 2007-07-18, 10:56
Contact:

#3 Post by ofek »

We just switched to a zero-warning policy here, so i receive quite a few of them myself..

Thanks for your help.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest