Pedro Izecksohn <[EMAIL PROTECTED]> wrote:
> --- peternilsson42 wrote:
> > "-Wconversion Warn for implicit conversions that may alter
> > a value. ... "
> > 
> > Integral promotions don't alter the value.
> > 
> > Maybe you need -Wsign-conversion
> 
> gcc -Wall -Wsign-conversion problem.c -o problem
> cc1: error: unrecognized command line option "-Wsign-conversion"

Time you updated then...

<http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Option-Index.html#Option-
Index>

  % gcc --version
  gcc.exe (GCC) 4.3.2
  Copyright (C) 2008 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.
  There is NO warranty; not even for MERCHANTABILITY or FITNESS
  FOR A PARTICULAR PURPOSE.
  
  % type problem.c
  #include <stdio.h>
  
  int main (void) {
    unsigned short int a;
    unsigned long long int b, c;
    a = -1;
    b = (a*a);
    c = ((unsigned int)a*(unsigned int)a);
    printf ("Why %llx != %llx ?\n", b, c);
    return 0;
  }
  
  % gcc -std=c99 -Wsign-conversion problem.c -o problem.exe
  problem.c: In function 'main':
  problem.c:6: warning: negative integer implicitly converted
  to  unsigned type
  problem.c:7: warning: conversion to 'long long unsigned int'
  from 'int' may change the sign of the result
  
  % problem
  Why fffffffffffe0001 != fffe0001 ?

-- 
Peter

Reply via email to