Mar 14, 2019 at 4:11am UTC
I was doing some research on some closed source codecs and was given this code.
That P3() seems not ANSI-C. What version is that from?
Thank you!
[code[
void data_dec P1((c, a, str), codec c, codec_byte * a, in_stream * str)
{
}
[/code]
Mar 14, 2019 at 4:16am UTC
What P3 ?
Also, macros are typically written in upper case.
So if something looks weird, be prepared for trying to dig through some pre-processor abuse.
Mar 14, 2019 at 4:21am UTC
Oh typo.
I meant P1((c,a,str),.
Mar 14, 2019 at 4:23am UTC
Looks like some weird variant of older K&R function declaration.
https://stackoverflow.com/questions/1630631/alternative-kr-c-syntax-for-function-declaration-versus-prototypes
Mar 14, 2019 at 4:26am UTC
Thank you FurryGuy.
I do see a define called,
#define P1(a, b, c, d) a b; c; d;
How would that be translateed to modern ANSI-C?
Last edited on Mar 14, 2019 at 4:27am UTC
Mar 14, 2019 at 5:17am UTC
I didn't see your post before I posted mine. Apparently it is called P1. I thought it probably was called P3 since it would be hard-coded for three parameters and you would need different ones for different numbers of parameters.
Mar 14, 2019 at 6:39am UTC
I see. If it's an old version/style in C then i see no need to dig at that.
Thank you all!