RE: [cc65] Function prototyping - different in CC65?

Date view Thread view Subject view

From: Greg Long (cc65_at_maneuveringspeed.com)
Date: 2003-03-04 20:55:07


ahhh... I think I found the culprit.  I think there IS a rand()
function...wonder why I couldn't call it earlier...is it not in time.h?

surely there must be others who've migrated from MS C++ to CC65 who
undestand the frustration.

-----Original Message-----
From: owner-cc65_at_musoftware.de [mailto:owner-cc65_at_musoftware.de] On
Behalf Of Greg Long
Sent: Tuesday, March 04, 2003 11:25 AM
To: cc65_at_musoftware.de
Subject: [cc65] Function prototyping - different in CC65?


Looking at some online C tutorials, function prototypes seem pretty much
like C++, so I have to ask the question:  What am I doing here that CC65
does not like?

C:\Program Files\vice\sort.c>cl65 -v ShellSort.c
ShellSort.c(13): Error: Conflicting types for `rand'
Line: int main()
ShellSort.c(35): Error: Conflicting types for `rand'
Line:  unsigned int a=10;

------

#include <stdlib.h>
#include <time.h>
#include <conio.h>

//function declaration, line 13 follows this line
unsigned int rand();

//unsigned long r_seed = clock();

int main()
{
	unsigned int size = 10000;
	unsigned int i = size;
    
	unsigned int* ra;
	ra = (unsigned int*) malloc(size*2);

	//generate random numbers
	while(i)
	{
		ra[i] = rand();
		--i;
	}
	return 0;
}

unsigned int rand()
{
	//this code to be replaced with a random number
	//generating algorithm
	unsigned int a=10;

	return a;
}

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-03-04 20:56:12 CET