类型转换在libSVM中有问题吗?

时间:2014-11-06 15:38:10

标签: c++ casting type-conversion svm libsvm

LibSVM我有一个非常简单的'问题':

我在Mac,OSX,10.9.5。我从here克隆了libSVM repo,根据README上的说明,只需运行make

这是假设编译libSVM程序没有问题,但我收到一连串关于签名的警告。

毋庸置疑,这让我感到担忧,因为不知不觉中的迹象正在发生变化,我对分类器没有信心。这应该是一个值得关注的问题,如果是这样,我该如何解决它?

这是我从命令行运行make命令时得到的结果:

adam-MacBook-Pro:libsvm adam$ make
c++ -Wall -Wconversion -O3 -fPIC -c svm.cpp
svm.cpp:96:26: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
        head = (head_t *)calloc(l,sizeof(head_t));      // initialized to 0
                         ~~~~~~ ^
svm.cpp:98:10: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion]
        size -= l * sizeof(head_t) / sizeof(Qfloat);
                ^ ~
svm.cpp:146:54: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion]
                h->data = (Qfloat *)realloc(h->data,sizeof(Qfloat)*len);
                                                                  ~^~~
svm.cpp:1651:38: warning: implicit conversion changes signedness: 'const int' to 'unsigned long' [-Wsign-conversion]
        double *alpha = Malloc(double,prob->l);
                        ~~~~~~~~~~~~~~~~~~~~^~
svm.cpp:39:40: note: expanded from macro 'Malloc'
#define Malloc(type,n) (type *)malloc((n)*sizeof(type))
                                       ^
svm.cpp:1722:26: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion]
        double *t=Malloc(double,l);
                  ~~~~~~~~~~~~~~^~
svm.cpp:39:40: note: expanded from macro 'Malloc'
#define Malloc(type,n) (type *)malloc((n)*sizeof(type))
                                       ^
svm.cpp:1833:29: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion]

0 个答案:

没有答案