On 01/08/2016 06:21 PM, Martin Sebor wrote:
The point of this warning is that there are certain cases of incompatible
types that are less serious than others - namely, those where the only
aspect of the type that is different is its signedness.  Those get a more
specific warning, which is given under more restrictive conditions.

FWIW, below is a survey of a few popular compilers I have access
to and how they treat the problem and under what option.  The C
code I used to test is:

    void foo (char *p, signed char *q) { q = p; }

Clang (controlled by -Wpointer-sign, enabled by default):

warning: assigning to 'signed char *' from 'char *' converts
         between pointers to integer types with different sign
         [-Wpointer-sign]

EDG eccp (warns by default):
warning: a value of type "char *" cannot be assigned to an
          entity of type "signed char *"

Intel ICC (requires -Wpointer-sign):

warning #556: a value of type "char *" cannot be assigned to
              an entity of type "signed char *"

Oracle CC (warns by default):
warning: assignment type mismatch:
        pointer to signed char "=" pointer to char

IBM XLC (warns by default):
1506-068 (W) Operation between types "signed char*" and "char*"
             is not allowed.

Visual C (rejects code by default):
error C2440: '=': cannot convert from 'char *' to 'signed char *'
note: Types pointed to are unrelated;

Martin

Reply via email to