I use glib's testunit in visual studio 2002. But when compling the code, i find warnings.



hi,glib's hero:


I use glib's testunit in visual studio 2002. But when compling the code, i find warnings.

The code:

g_assert_cmpint(3, ==, 2);

The warnings:

warning C4244: conversion from '__int64'  to 'long double' , possible loss of data

In glib' s source code(gtestutils.h):


#define g_assert_cmpint(n1, cmp, n2) \
  do { gint64 __n1 = (n1), __n2 = (n2); \
     if (__n1 cmp __n2) ; else \
        g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
           #n1 " " #cmp " " #n2, __n1, #cmp, __n2, 'i'); } while (0)

May be correct:

#define g_assert_cmpint(n1, cmp, n2) \
  do { gint64 __n1 = (n1), __n2 = (n2); \
    if (__n1 cmp __n2) ; else \
       g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
          #n1 " " #cmp " " #n2, (long double)__n1, #cmp, (long double)__n2, 'i'); } while (0)


thanks



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]