I'll try the -Wconversion flag once more. May be i rushed through my test the first time. thanks --- On Mon, 9/20/10, John Graham <johngavingraham@xxxxxxxxxxxxxx> wrote: > From: John Graham <johngavingraham@xxxxxxxxxxxxxx> > Subject: Re: I'd like to get warnings on loss of data during implicit conversions > To: "Jeff Saremi" <jeffsaremi@xxxxxxxxx> > Cc: gcc-help@xxxxxxxxxxx > Received: Monday, September 20, 2010, 12:06 PM > -Wconversion should do exactly what > you want - at least it does for me > in this example: > > --- > > #include <stdint.h> > int main(void) > { > Â Â int32_t l; > Â Â int16_t s = l; > } > > --- > > $ gcc test.c > $ gcc test.c -Wconversion > test.c: In function âmainâ: > test.c:6: warning: conversion to âint16_tâ from > âint32_tâ may alter its value > $ > > --- > > If it doesn't work for you, are you sure that the > conversion you're > expecting to produce a warning is *really* a narrowing > conversion? > > John G > > > > On Mon, Sep 20, 2010 at 4:15 PM, Jeff Saremi <jeffsaremi@xxxxxxxxx> > wrote: > > When i compile my c or C++ code under Microsoft > compiler I get warnings like the following: > > warning C4244: 'argument' : conversion from 'unsigned > long' to 'uint16 > > ', possible loss of data > > > > However, compiling the same code with Gcc/G++ does not > produce this warning at all? > > > > My question is: > > - is this a standard (i mean ISO) warning? or is it a > courtesy warning? > > - Does gcc have something similar to this? If so which > option is that? > > > > I have tried the following individiaully and in > combination to no avail: > > > > -Wall, -Wextra, -Wconversion > > thanks > > jeff > > > > >