Thread View: comp.os.linux.development.apps
2 messages
2 total messages
Started by Yusoff Y M
Mon, 04 Dec 1995 18:09
HELP-Conflicting types and casting float to NULL errors on GCC 2.7.0 Linux
Author: Yusoff Y M
Date: Mon, 04 Dec 1995 18:09
Date: Mon, 04 Dec 1995 18:09
64 lines
2692 bytes
2692 bytes
Hi,
I need some help for two error messages that I get from GCC 2.7.0 on
Linux and if possible suggestions to get around them. These errors don't
occur on the Sun w/stations in school so any suggestions to get around the
errors would be welcome since that'll allow me to work on my Linux box at home.
The error messages that I give is approximate since I foolishly left the piece
of back-of-the-envelope paper that I wrote them on back home.
Right, here goes:
1st Case:
----------------
<#INCLUDEs, comments, bla, bla>
int printf();
int fprintf();
int fputc(char c, FILE *stream);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<rest of program>
----------------
Compiler would say that conflicting type in function prototype; previously
declared in <stdio.h> which happened to be:
int __fputc(int, FILE *);
or something like that.
2nd. Case:
________________
<beginning of program....>
/* check for validity of entered arguments */
if ((b == (float)NULL) || (h == (float)NULL) || (r == (float)NULL)
^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^
|| (i == (int)NULL) || (C == (int)NULL))
usage();
<rest of program>
----------------
I really can't remember what the error message was but basically, it implied
that the compiler didn't allow casting NULL to float. So I can't check the
entered command line arguments.
That's it. Hope somebody can shed some light on my plight. It might actually
be something simple. But do point it out anyway since I'm quite new to C.
The first case is not my own code but my instructor's since I have to use some of
his code for the next assignment. The second case is part of my code. I really
stuck here because they actually compile on the Suns. Where's the fault lie then?
Thanks ever so much.
--
_______________________________________ _____________________________________
|Yusseri Md. Yusoff | |
|Dept. of Electronic Systems Engineering| AREA STILL UNDER |
|University of Essex | |
|Colchester CO4 3SQ | CONSTRUCTION |
|email:ymyuso@essex.ac.uk | |
|_______________________________________|_____________________________________|
Re: HELP-Conflicting types and casting float to NULL errors on GCC 2.7.0 Linux
Author: Tanmoy Bhattacharya
Date: Tue, 05 Dec 1995 00:48
Date: Tue, 05 Dec 1995 00:48
32 lines
1922 bytes
1922 bytes
In article <49vdg5$fh3@seralph9.essex.ac.uk>, ymyuso@esl3.NoSubdomain.NoDomain (Yusoff Y M) writes: |> Hi, |> I need some help for two error messages that I get from GCC 2.7.0 on |> Linux and if possible suggestions to get around them. These errors don't <snip> |> int fputc(char c, FILE *stream); fputc does _not_ take a char as its first argument: it takes an int which it converts to unsigned char inside. <snip> |> /* check for validity of entered arguments */ |> if ((b == (float)NULL) || (h == (float)NULL) || (r == (float)NULL) |> ^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^ |> || (i == (int)NULL) || (C == (int)NULL)) |> usage(); I have no idea what (float)NULL was supposed to mean. NULL is a special value which can be portably used in a pointer context to create a null pointer. An operand of the cast (float) or (int) is not a place where NULL can be used. What are you trying to do? Cheers Tanmoy -- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242) Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544 Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>, <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/ internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html> fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads