Log in

View Full Version : old style functions??


Joohoo
20-02-2007, 11:05
Hello every one, as I sit here waiting to give the robot some tlc I wrote a function to drive our robot based upon encoders attached to the drive wheels

I go to compile it and the compiler says that [qutoe]old style function declarations not supported[/quote]
when ni go to look at where the compiler says the problem is it points to the last } of the function. I checked that all the {}'s are ending themselves.

SO if any one is free at the moment could they tell me what the old style is and what I have to do to convert it over to the 'new' style

thankyou in advance

buddy.smith
20-02-2007, 11:09
Why don't you post the code?

Here's an "old style" function declaration:

int myFunc( param1, param2, param3)
char param1;
int param2;
short param3;
{
printf("Got %d %d %d\n", param1, param2, param3);
}


Here's a "new style" function declaration:

int myFunc( char param1, int param2, short param3 )
{
.....
}


(edited for correctness, as pointed out below)

Alan Anderson
20-02-2007, 11:31
http://support.microsoft.com/kb/79845 explains the difference.

kaszeta
20-02-2007, 11:43
Why don't you post the code?

Here's an "old style" function declaration:

int myFunc( param1, param2, param3)
{
char param1;
int param2;
short param3;
printf("Got %d %d %d\n", param1, param2, param3);
}



Close, for "old style" function declarations the parameters went between the ) and the {:


int myFunc( param1, param2, param3)
char param1;
int param2;
short param3;
{
printf("Got %d %d %d\n", param1, param2, param3);
}


Usually you get this error when the { character has been omitted.