typedef

Martin Strauss mys@faveve.uni-stuttgart.de
Mon Mar 12 14:33:00 GMT 2001


/*
Hi !
I'm searching for a compiler flag or a better idea than I had ...

The following program compiles usually without reporting a warning ...
but it should because of a kind of type missmatch :
*/

typedef int value_t;
typedef int counter_t;
int main(){
 value_t v=0;
 counter_t c=0;
 v=c;  /* makes no sense */
 return 0;
}

/*
 v=c should never happen within the code, so I would like to have
 a report when it happens.
 Only with a explizit cast this kind of thing should be valid.

 If I change the type of v to char* it works fine with the warning :
v.c:7: warning: assignment makes pointer from integer without a cast

 Is there a possibility to warn before substituting value_t and
 counter_t to int ?
*/
/*
****************************************************************************
Martin Strauss 
email        : mys@faveve.uni-stuttgart.de
privat       : Allmandring 12b Zi. 13, 70569 Stuttgart, Tel. 0711/683635
Diplomarbeit : 3. Phys. Institut, NWZ II, Raum 6.519, Tel. 0711/6855241 
*/



More information about the Gcc-help mailing list