ervinbosenbacher / lz4

Automatically exported from code.google.com/p/lz4
0 stars 0 forks source link

Add proper cast and pragma to prevent warnings. #64

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
With Visual Studio 2012 (Win32 and x64), when you specify maximum warning level 
(/W4) to the compiler,
you will see some warnings (attached file: lz4_vc11_w4_warnings.txt)

There are 3 kind of warnings:

 (1) C4127: conditional expression is constant
 (2) C4701: potentially uninitialized local variable X used
 (3) C4244: conversion from X to Y, possible loss of data

I think

 (1) is not so useful.
 (2) is useful for development (maybe), but not so useful for release code (just confuse users).
 (3) is must be prevented by proper cast.

so I add proper cast and pragma to fix these warnings.

Please look a attached patch file (lz4_proper_cast_and_disable_warnings.patch).

Original issue reported on code.google.com by takayuki...@gmail.com on 4 Apr 2013 at 1:17

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the notice. I'll look into it.

Original comment by yann.col...@gmail.com on 4 Apr 2013 at 1:37

GoogleCodeExporter commented 9 years ago

Original comment by yann.col...@gmail.com on 4 Apr 2013 at 3:20

GoogleCodeExporter commented 9 years ago
The dec64table changes also fix warnings with clang:
error: constant expression evaluates to -1 which cannot be narrowed to type 
'size_t'
      (aka 'unsigned long') [-Wc++11-narrowing]

Original comment by jrmui...@gmail.com on 4 Apr 2013 at 8:31

GoogleCodeExporter commented 9 years ago
good point

Original comment by yann.col...@gmail.com on 5 Apr 2013 at 6:19

GoogleCodeExporter commented 9 years ago
Fix integrated into r92. Thanks!

Original comment by yann.col...@gmail.com on 13 Apr 2013 at 9:32