Strange warning about passing argument with different width due to prototype with gcc 4.4.0 on 64 bits machine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
I'm trying to compile a simple program with gcc 4.4.0 in an intel Xeon
machine running RHEL (I haven't any other posibility). I'm using the
warning flag -Wconversion in order to check type conversions without
explicit cast. When I work with data types as int and long in
functions and pass the data without explicit casts the warning flag
runs OK and when I do the explicit cast the warning dissapears. But
when I do the same with a function that admits a single char argument,
allways (with explicit cast too) the warning appears as

warning: passing argument 1 of ‘printChar’ with different width due to prototype

Attached I sent 4 files (three src and a Makefile) in order to
reproduce the behaviour.

But if I run the Makefile in my laptop (iBook ppc running Debian
GNU/Linux) with gcc 4.4.4 all runs OK. The warning not appears in the
case of char argument. I don't know if it is a bug of gcc 4.4.0 or a
feature related to 64 bits or a bug in RHEL gcc.

Can someone reproduce the behaviour?

Thanks

-- 
*****************************************
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"libtest.h"
int main()
{
    printf("Small test program:\n");
    printChar('E');
    printChar((char)'E');
    printLong(1);
    printLong((long)1);
    return 0;
}

Attachment: Makefile
Description: Binary data


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux