------- Comment #16 from manu at gcc dot gnu dot org 2007-01-28 19:47 ------- (In reply to comment #15) > FYI: I'm right now auditing the code for conversions larger -> smaller integer > type and immediately adjusting it in the process. Only very few so far. To be > clear, I'm punting on conversions between same size types which, apparently, > people don't believe should be flagged as part of -Wconversion, maybe not at > all.
I think that we agreed that people using -Wconversion do want warnings for larger->smaller conversions. When you mention same size types, do you mean conversions between signed and unsigned types? or am I missing something here? (we also warn for conversions between integer and floating-point types, no matter what size they are). Nevertheless, I am interested in how many (large signed) -> (small unsigned) you have found, since it is not clear to me whether those should be warned by -Wconversion or should be considered a signedness conversion. For example: void f (char *p1, char *p2) { unsigned short us = p1 - p2; } Gabriel, what do you think about this case? I am also interested in how many (negative constant)->unsigned conversions you have found, because I would like to keep those in Wconversion as they have always been. Thanks. Manuel. PS: Also, currently Wconversion in C++ is not complete: there are some (many?) situations that we want to warn but we don't do it yet. In particular, any conversion that uses convert_like_real (which I think that is used quite often) and implicit conversions of the operands of binary operations. I am waiting for this patch http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00799.html to be reviewed. So, I am afraid that you may get more warnings once that patch gets committed. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30464