NO

Author Topic: superfluous warning singlethread level 2  (Read 1997 times)

fuerst

  • Guest
superfluous warning singlethread level 2
« on: March 18, 2013, 09:31:42 pm »
Code: [Select]
#include <stdio.h>

int main( void ) {

int c = 'a';
(void)putchar(c);

(void)putc(c, stdout);
return 0;
}

/* Compiling Single-Thread with warning-level 2 gives the following warning.
> pocc.exe -std:C11 -Tx86-coff -Ob0 -fp:precise -W2 -Gd  "C:\Users\brg\Documents\Pelles C Projects\Test\Test.c" -Fo"C:\Users\brg\Documents\Pelles C Projects\Test\output\Test.obj"
C:\Users\brg\Documents\Pelles C Projects\Test\Test.c(6): warning #2215: Conversion from 'int' to 'unsigned char'; possible loss of data.
C:\Users\brg\Documents\Pelles C Projects\Test\Test.c(8): warning #2215: Conversion from 'int' to 'unsigned char'; possible loss of data.
*/

Code: [Select]
/* Suggested corrections (unsigned char)-cast in stdio.h cmp. //-Comments below ...

#if !defined(__MT__) && !defined(_DLL)
#define getc(str)     ((str)->ptr < (str)->getend ? *(str)->ptr++ : (fgetc)(str))
#define getchar()     (__filetab[0]->ptr < __filetab[0]->getend ? *__filetab[0]->ptr++ : (fgetc)(__filetab[0]))
  #define putc(c,str)   ((str)->ptr < (str)->putend ? (*(str)->ptr++ = c) : (fputc)(c, str))
//#define putc(c,str)   ((str)->ptr < (str)->putend ? (*(str)->ptr++ = (unsigned char)(c)) : (fputc)(c, str))
  #define putchar(c)    (__filetab[1]->ptr < __filetab[1]->putend ? (*__filetab[1]->ptr++ = c) : (fputc)(c, __filetab[1]))
//#define putchar(c)    (__filetab[1]->ptr < __filetab[1]->putend ? (*__filetab[1]->ptr++ = (unsigned char)(c)) : (fputc)(c, __filetab[1]))
#define _fileno(str)  ((str)->fh)
#endif

*/