Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   old style functions?? (http://www.chiefdelphi.com/forums/showthread.php?t=54642)

Joohoo 20-02-2007 11:05

old style functions??
 
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

Re: old style functions??
 
Why don't you post the code?

Here's an "old style" function declaration:
Code:

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:
Code:

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

(edited for correctness, as pointed out below)

Alan Anderson 20-02-2007 11:31

Re: old style functions??
 
http://support.microsoft.com/kb/79845 explains the difference.

kaszeta 20-02-2007 11:43

Re: old style functions??
 
Quote:

Originally Posted by buddy.smith (Post 582380)
Why don't you post the code?

Here's an "old style" function declaration:
Code:

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 {:

Code:

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.


All times are GMT -5. The time now is 04:51.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi