bug-gsl
[Top][All Lists]
Advanced

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

[Bug-gsl] GSL compiler warnings


From: Brian Gladman
Subject: [Bug-gsl] GSL compiler warnings
Date: Wed, 03 Jul 2013 09:02:52 +0100
User-agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7

Microsoft has just released a preview of Visual Studio 2013 with support
for some C99 features and some further compiler warnings.

GSL compiles and builds fine and the tests pass with VS 2013 but there
are a number of compiler warnings which I feel are worth consideration.

-----------------

In wavelet\dwt.c (line 47): warning C4334: '<<' : result of 32-bit shift
implicitly converted to 64 bits (was 64-bit shift intended?)

Changing

  ntest = (1 << logn);

to

  ntest = ((size_t)1 << logn);

resolves this.  This may not be necessary but it costs nothing.

-----------------

Throughout GSL there are a large number of warnings of this form:

warning C4267: 'function' : conversion from 'size_t' to 'int', possible
loss of data

Many of these are caused by using the inline functions:

GSL_INT_MIN
GSL_INT_MAX

in situations where the input variables and the result are all defined
as size_t.

These are probably benign warnings but the conversions involved are all
sources of potential problems so I wonder whether GSL should have the
inline functions:

GSL_SIZE_T_MIN
GSL_SIZE_T_MAX

for use in such situations?

-----------------

   with regards,

      Brian Gladman



reply via email to

[Prev in Thread] Current Thread [Next in Thread]