[Asterisk-Dev] Re: asterisk/include/asterisk utils.h,1.46,1.47

Luigi Rizzo rizzo at icir.org
Sun Oct 30 11:23:53 MST 2005


On Sun, Oct 30, 2005 at 01:07:59PM -0600, Kevin P. Fleming wrote:
> Luigi Rizzo wrote:
> 
> > the option is -Wconversion not -Wimplicit-cast as i erroneously said.
> > The operand triggering the bug was of type mode_t, defined as
> > 
> > 	typedef        u_int16_t       mode_t
> > 
> > and one of the offending compilers is gcc 2.95.
> > Just for the records.
> 
> OK, I'll keep that in mind, although given our official stance 
> (requiring GCC >= 3.x), that should be less of an issue in the future.


The following fails with gcc 3.4.4 as well, for t defined as [u]int{8|16}_t,
on FreeBSD at least.

i'd be curious to know how it works on linux or other platforms

	cheers
	luigi

/* test -Wcomversion.
 * compile with
 * CFLAGS += -Wall -Werror -Wconversion
 */

#include <sys/types.h>
typedef uint16_t t;

int f(t x)
{
	return x*x;
}

int main(int argc, char *argv[])
{
	t b = 12;

	return f(b);
}



More information about the asterisk-dev mailing list