Hi,

On Thu, Oct 11, 2018 at 01:40:16PM +0300, Lev Stipakov wrote:
> > Since crypto_overhead and crypto_max_overhead() are both size_t, and
> > frame_add_to_extra_frame() is declared to take an "unsigned int" now,
> > this cast should not be necessary.
> 
> 
> Visual Studio disagrees. Without explicit cast I got
> 
> > warning C4267: 'function': conversion from 'size_t' to 'const unsigned
> int', possible loss of data
> 
> https://docs.microsoft.com/fi-fi/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4267?view=vs-2017
> 
> 
> 'var' : conversion from 'size_t' to 'type', possible loss of data
> The compiler detected a conversion from size_t to a smaller type.

So, maybe "crypto_overhead" and "crypto_max_overhead()" should be
changed to be just "int" here...?

For something which has a numeric value between "10-ish" and "100" (maybe),
using a 64bit integer initially and then adding casts because we want
to work with 32bit integers later on and not be warned about it sounds
like the wrong way to tackle this...

I know that Steffan likes using size_t for "things that have a size"
but I find it a bit questionable here :-)


> > Unnecessary casts hide bugs and hurt my eyes...
> 
> OTOH this is level 3 warning, which we have over 500. Since we'll probably
> change level warning to 2 and
> GCC doesn't complain, I'll remove it.

I'm all for fixing compiler warnings, but I hate silencing warnings with
casts that serve no purpose but "silence warning".  If we can fix it
for real, so the compiler has nothing to warn about, this is way better.

(It might not always be possible, like const/no-const mismatch on some
API functions, or struct sockaddr* madness on the socket API)

gert
-- 
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             g...@greenie.muc.de

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to