Needed help on compiler option
Andrew Haley
aph@redhat.com
Tue May 17 14:36:00 GMT 2011
On 05/17/2011 11:48 AM, bhamidipati subrahmanyam wrote:
> Pls have a look at the following code snippet....
>
> void test(int i)
> {
> printf("i:%d\n",i);
> }
>
> int main()
> {
> char arr[100];
>
> arr[1] = 10;
>
> test(arr[1]);
>
> return 0;
> }
>
> Logically, this code is working. But this simple concept resembles a
> real time problem,
> where the compiler should generate a warning when there is a type mismatch.
Where is the type mismatch? All I see is the implicit widening argument
conversion described in 6.5.2.2 Para 7. This doesn't alter the value,
so it's not flagged by -Wconversion.
Andrew.
More information about the Gcc-help
mailing list