Strange C statement... or function?

You can talk about almost anything that you want to on this board.

Moderator: Moderators

Post Reply
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Strange C statement... or function?

Post by Zepper »

File details:
/* ioapi.c -- IO base function header for compress/uncompress .zip
files using zlib + zip or unzip API

Version 1.01h, December 28th, 2009

Copyright (C) 1998-2009 Gilles Vollant
*/

What's the following???

Code: Select all

long ZCALLBACK ftell_file_func (opaque, stream)
   voidpf opaque;
   voidpf stream;
{
    long ret;
    ret = ftell((FILE *)stream);
    return ret;
}
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Strange C statement... or function?

Post by tepples »

Are you confused by the K&R-style (pre-C89) prototype that puts the types after the closing parenthesis?
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Strange C statement... or function?

Post by Zepper »

tepples wrote:Are you confused by the K&R-style (pre-C89) prototype that puts the types after the closing parenthesis?
I have no idea what means such statement.
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: Strange C statement... or function?

Post by thefox »

Old versions of C had a different way of declaring argument types. It's equivalent to this:

Code: Select all

long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
{
    long ret;
    ret = ftell((FILE *)stream);
    return ret;
}
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Post Reply