I have a copy of the MD5 algorithm and I'm taking a look at the source. It's pretty interesting but there are a few things that I'm curious about and I was wondering if anyone a bit more intuitive than I could help me out.
The function declarations in the MD5 files are a bit unfamiliar to me. There is a macro used called PROTO_LIST, which I'm still not sure as to what this thing is doing exactly, but it's littered everywhere throughout the source. The macros is defined as follows:
Code:
#if PROTOTYPES
#define PROTO_LIST(list) list
#else
#define PROTO_LIST(list) ()
#endif
(NOTE: PROTOTYPES macro is apparently dependent upon the target compiler supporting function argument prototyping according to the header)
For example, md5.h prototypes three functions that utilise this macro in that particular statement. For example, one prototype looks like this:
Code:
void FuncName PROTO_LIST ((MD5_CTX *))
The signature here isn't too unfamiliar to me with the exception of the position of the PROTO_LIST macro. So here is a function with an unnamed argument of type MD5_CTX*. As expected, at the function's definition in the accompanying source file, the argument is named but this is where things get really confusing for me as I've never seen this type of definition before:
Code:
void FuncName (context)
MD5_CTX *context;
{
// Code omitted for brevity...
}
To me, this resembles an initializer list found in C++ with constructors but I certainly don't think that is the case here. So my questions about this are (1) how is this legal code in C and (2) what functionality has the PROTO_LIST macro provided for the function?