Re: C4244 Warning with +=
- From: "Matt" <Matt@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 26 Aug 2005 08:37:32 -0700
Many thanks for the links. I guess that answers my question although i think
i'd still argue that when the types are the same there should be no warning,
after all it's perfectly possible for the ++ or -- operators to overflow but
you don't get warnings about that.
Matt
"Igor Tandetnik" wrote:
> Matt <Matt@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> > I'm compiling my code with warning level 4 and i am getting C4244
> > warnings: conversion from 'int' to 'unsigned short', possible loss of
> > data on code like this:
> >
> > WORD w1 = 5;
> > WORD w2 = 2;
> >
> > w1 += w2; // <--- generates warning
> >
> > Both types match - how can i get rid of this warning?
>
> This was discussed at some length, e.g. here
>
> http://groups.google.com/group/microsoft.public.vc.language/browse_frm/thread/95ecc316830c1562/a713ae3345f0c810
> http://groups.google.com/group/microsoft.public.vc.language/browse_frm/thread/d95905585ebf6d7c/71dab3957a027827
>
> --
> With best wishes,
> Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925
>
>
>
.
- References:
- C4244 Warning with +=
- From: Matt
- Re: C4244 Warning with +=
- From: Igor Tandetnik
- C4244 Warning with +=
- Prev by Date: Check Service Running
- Next by Date: Re: Any way to force derived classes to implement operator =?
- Previous by thread: Re: C4244 Warning with +=
- Next by thread: Is there any method to increase the size of GlobalHeap manually?
- Index(es):
Relevant Pages
|