Reputation: 1802
Notice the space in between some_name
and some_function
. I have seen this in a .c
file and was wondering what is going on here.
int some_name some_function{
}
Thanks
EDIT:
The code in question is:
int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
{
return avcodec_open2(avctx, codec, NULL);
}
It's from utils.c
Upvotes: 1
Views: 277
Reputation: 17243
One part is most likely a macro that expands to nothing (but serves documentaton) or some special attribute, like __stdcall, __declspec(noreturn), __declspec(dllexport)...
EDIT to reflect new info:
definition of yours looks like this:
51 #ifndef attribute_align_arg
52 #if ARCH_X86_32 && AV_GCC_VERSION_AT_LEAST(4,2)
53 # define attribute_align_arg __attribute__((force_align_arg_pointer))
54 #else
55 # define attribute_align_arg
56 #endif
57 #endif
Upvotes: 8
Reputation: 11950
That looks like either really ugly macros, or very old C. Once upon a time, C functions defaulted to returning int, and always either (depending on implementation), assumed an integer argument or allowed a variable number of arguments.
Some calling conventions require that the caller provide the arguments and then clean them up, so that would work. (If, however, the callee, that is, 'some_function', had to clean up the memory for the arguments itself, then the number of arguments is fixed).
That said, I would still strongly suspect some macro usage, possibly in addition to implied variable argumetns, despite the incredibly bad naming in the example. Does the original code contain any keywords in upper-case, or other conventions that indicate macro use? Even without those conventions, I would still suspect macros.
EDIT: The code provided in the question was completely changed. "attribute_align_arg" is likely either a macro or a compiler-specific attribute. What remains is a completely bog-standard C function, with specified arguments. As a result, Balog's answer above is the one to accept here.
Upvotes: 0