http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53391

--- Comment #2 from Keith Thompson <Keith.S.Thompson at gmail dot com> 
2012-05-18 18:26:31 UTC ---
The cleverness I was referring to was having diagnostics refer to an
appropriate typedef rather than to the original type (e.g., "size_t" rather
than "unsigned int").  I find this clever in a *good* way.

The conversion is a no-op if my_long happens to be the same type as long, as it
is in this example -- but it's very useful from the programmer's point of view
if my_long (or something with a more meaningful name) *could* be either long or
int.

I suppose solving this would require saving some information about the cast so
that the name of the type of the expression ("my_long" rather than "long") can
be referred to in diagnostic messages.

I should note that this is not production code.  The original program was
intended to use "%ld" and convert the argument to long; I ran into the
misleading warning due to a logic error.

Reply via email to