The difference between -Wconversion between gcc and g ++

Possible duplicate:
Can I give GCC a warning about passing too wide types to functions?

Consider the following test program:

static void func(int a)
{
}

int main()
{
    unsigned int b = 42;

    func(b);

    return 0;
}

Compiling with gcc:

lol @ mac : ~ / projects $ gcc -Wconversion testit.c
testit.c: In function âmainâ:
testit.c: 11: warning: passing argument 1 of âfuncâ as signed due to prototype
lol @ mac : ~ / projects $

But there is no warning in g ++ !:

lol @ mac : ~ / projects $ g ++ -Wconversion testit.c
 lol @ mac : ~ / projects $

What is the reason for this and is there a way to get the same warning when compiling C ++ code?

+5
source share
2

-Wconversion:

++, -Wsign-.

, GCC. 4.0.1, -Wsign-conversion.

+4
+2

All Articles