[ofw] RE: [OPENSM] cast to remove warnings about signed vs. unsigned comparisons

Sean Hefty sean.hefty at intel.com
Thu Oct 1 10:10:13 PDT 2009


>I've always felt the warning on implicit cast from larger to smaller
>type to be somewhat useless - that is an unavoidable operation when
>working with networking. Adding casts does nothing to actually improve
>the code, and trying to change to smaller types results in worse code
>gen and no improvement in function.

An explicit cast lets someone reading the code know that the original programmer
was aware that data could be loss, or that data loss wouldn't occur because of
the range of the data.  IMO, adding explicit casts to the code is better than
having an equally number of implicit casts.

>Maybe OFW would be better off just turning that warning off? :)

I've tried.  If there's a way to do this, I haven't found it.  The /W<whatever
number this is> option hasn't worked for me.

- Sean




More information about the ofw mailing list