[pcre-dev] [Bug 2024] New: MSVC C++ warning due to conversio…

Αρχική Σελίδα
Delete this message
Συντάκτης: admin
Ημερομηνία:  
Προς: pcre-dev
Αντικείμενο: [pcre-dev] [Bug 2024] New: MSVC C++ warning due to conversion from ptrdiff_t to int in pcre_exec.c
https://bugs.exim.org/show_bug.cgi?id=2024

            Bug ID: 2024
           Summary: MSVC C++ warning due to conversion from ptrdiff_t to
                    int in pcre_exec.c
           Product: PCRE
           Version: 8.40
          Hardware: x86-64
                OS: Windows
            Status: NEW
          Severity: wishlist
          Priority: medium
         Component: Code
          Assignee: ph10@???
          Reporter: milan@???
                CC: pcre-dev@???


Compiling PCRE-8.40 using any Visual Studio version and the x64 Microsoft
compilers, a warning is thrown for pcre_exec.c, due to an implicit conversion
of a pointer difference to int:

3rdparty\pcre-8.39\pcre_exec.c(672): warning C4244: 'initializing' : conversion
from '__int64' to 'int', possible loss of data

The relevant line (672):
int len = (char *)&rdepth - (char *)eptr;

int on x64 on Windows is still only 32 bits wide, while ptrdiff_t is 64 of
course.

Looking at the referenced pointers, it seems using 32 bits is safe. I therefore
propose explicitly casting the subtraction result to an int, to get rid of the
warning.

Thanks,
Milan

--
You are receiving this mail because:
You are on the CC list for the bug.