From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-12-31 19:21:47
Hi! On Wed, Dec 31, 2003 at 09:53:28AM -0800, Payton Byrd wrote: > I admit, I'm quite spoiled by C++, C#, and Java and > haven't had to program pure C before, so please be nice. I'm sorry to say that, but your program is full of errors. It's not a single one, it's a whole bunch of them. And no, I didn't debug it, I just compiled it and looked at the warnings. cc65: test.c(95): Warning: Function call without a prototype test.c(95): Warning: Converting integer to pointer without a cast test.c(95): Warning: Converting integer to pointer without a cast linkedlist.c(9): Warning: Function call without a prototype linkedlist.c(164): Warning: Function call without a prototype gcc: test.c: In function `main': test.c:86: warning: assignment from incompatible pointer type test.c:87: warning: assignment from incompatible pointer type test.c:95: warning: implicit declaration of function `strdup' test.c:95: warning: passing arg 1 of `NewNode' makes pointer from integer without a cast test.c:95: warning: passing arg 2 of `NewNode' makes pointer from integer without a cast test.c:80: warning: `List' might be used uninitialized in this function test.c:81: warning: `Node' might be used uninitialized in this function linkedlist.c: In function `NewList': linkedlist.c:9: warning: implicit declaration of function `malloc' linkedlist.c: In function `AppendNode': linkedlist.c:55: warning: statement with no effect linkedlist.c:56: warning: statement with no effect linkedlist.c: In function `PrintNode': linkedlist.c:117: warning: unsigned int format, PStringNode arg (arg 2) linkedlist.c:118: conversion to non-scalar type requested Above warnings come from about 5-10 serious problems in your code. The gcc warnings for line 80 and 81 in test.c are caused by the parameter passing for the NewList and NewNode functions: it is broken. You pass in a pointer, change this pointer in the function, but since the pointer is passed by value, the new value is not passed back. My strong suggestion would be to start with something simpler. And, if the compiler outputs warnings, in most cases this is not just for fun, so remove the cause. Regards Uz -- Ullrich von Bassewitz uz_at_musoftware.de ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2003-12-31 19:22:04 CET