Browsing the source code, I came across something completely unexpected. I didn't know you could put code in structs like this sample from kamby/kamby.c
Is this legal? If so, I'm going to use the heck out of it for my version of STOIC.
[Edit] Ok.. thanks for the help.. I'm used to seeing function types declared AFTER the parameters because pascal habits die hard. It looked like a run of the mill structure declaration to me.
I don't do a lot of C, but isn't this just a global function returning a pointer to a KaNode? If I remember correctly this is just Cs way of specifying a type is a struct same thing with the line in your example "struct KaNode *output = ..." someone feel free to correct me if I am wrong though.
That’s a function that returns a struct. In C structs live in their own namespace and references to them have to use the struct keyword unless you define a typedef.
If it makes you feel any better, I can't remember the last time I saw that construction in the wild. Idiomatic C codebases use a typedef for this 10 times out of 10.
[Edit] Ok.. thanks for the help.. I'm used to seeing function types declared AFTER the parameters because pascal habits die hard. It looked like a run of the mill structure declaration to me.