S
steve
When compiling the program
int main(void)
{
short a;
a = a + a;
return 0;
}
with gcc 4.3.3 -Wconversion I get the warning:
warning: conversion to 'short int' from 'int' may alter its value.
It looks like 'a' got promoted to an int. But I thought operands only
got promoted to the lowest type that included all the operands. FWIW,
I got the same warning when I changed the line to a=a+1. But I did
NOT get the warning when I just had a++.
Or is this warning completely bogus?
--
int main(void)
{
short a;
a = a + a;
return 0;
}
with gcc 4.3.3 -Wconversion I get the warning:
warning: conversion to 'short int' from 'int' may alter its value.
It looks like 'a' got promoted to an int. But I thought operands only
got promoted to the lowest type that included all the operands. FWIW,
I got the same warning when I changed the line to a=a+1. But I did
NOT get the warning when I just had a++.
Or is this warning completely bogus?
--