nesdev.com
http://forums.nesdev.com/

Strange C statement... or function?
http://forums.nesdev.com/viewtopic.php?f=5&t=17424
Page 1 of 1

Author:  Zepper [ Thu Jun 07, 2018 8:36 am ]
Post subject:  Strange C statement... or function?

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:
long ZCALLBACK ftell_file_func (opaque, stream)
   voidpf opaque;
   voidpf stream;
{
    long ret;
    ret = ftell((FILE *)stream);
    return ret;
}

Author:  tepples [ Thu Jun 07, 2018 8:39 am ]
Post subject:  Re: Strange C statement... or function?

Are you confused by the K&R-style (pre-C89) prototype that puts the types after the closing parenthesis?

Author:  Zepper [ Thu Jun 07, 2018 8:46 am ]
Post subject:  Re: Strange C statement... or function?

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.

Author:  thefox [ Thu Jun 07, 2018 9:02 am ]
Post subject:  Re: Strange C statement... or function?

Old versions of C had a different way of declaring argument types. It's equivalent to this:
Code:
long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
{
    long ret;
    ret = ftell((FILE *)stream);
    return ret;
}

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/