As a curiosity, gcc 4.5.1 compiled by myself for my ppc debian emits a warning of the type "conversion to size_t from int may change the sign" for the code size_t var=0; var = strspn("hello","lo"); var = (size_t)strspn("hello","lo"); where strspn returns a size_t type (http://linux.die.net/man/3/strspn). The warning appears in both cases. But the warning only appears with the flag -Wconversion combined with -O3/-O2 or -O1 optimizations. Apparently, in this version some warnings depends on the level of optimization. Attached I send the example files -- ***************************************** José Luis García Pallero jgpallero@xxxxxxxxx (o< / / \ V_/_ Use Debian GNU/Linux and enjoy! *****************************************
#ifndef _LIBTEST_H_ #define _LIBTEST_H_ #include<stdio.h> #ifdef __cplusplus extern "C" { #endif void printChar(const char data); void printLong(const long data); #ifdef __cplusplus } #endif #endif
#include"libtest.h" void printChar(const char data) { printf("Character is: %c\n",data); return; } void printLong(const long data) { printf("Long data is: %ld\n",data); return; }
#include<stdio.h> #include<stdlib.h> #include<string.h> #include"libtest.h" int main() { size_t var=0; printf("Small test program:\n"); printChar('E'); printChar((char)'E'); printLong(1); printLong((long)1); var = strspn("hello","lo"); var = (size_t)strspn("hello","lo"); return 0; }
Attachment:
Makefile
Description: Binary data