Am 22.12.2013 20:34, schrieb Gary Willoughby:
On Sunday, 22 December 2013 at 18:28:43 UTC, Benjamin Thaut wrote:
Am 22.12.2013 18:39, schrieb Gary Willoughby:
Ah right, so:

struct Tcl_Obj * CONST * objv

would be:

const(Tcl_Obj*)* objv  or  const(Tcl_Obj*)[] objv

Yes

Great thanks! I thought i had a pretty good handle on C but porting some
headers makes me scratch my head.

Yes, its sometimes really astonishing in what ways C-features can be abused. I very recently sumbled apon this:

void (*callbackFunc)(GtkWidget* widget, void* userData);

void registerCallback(callbackFunc func);

void userCallback(GtkEntry* entry)
{
  ...
}

void someFunc()
{
  registerCallback((callbackFunc)&userCallback);
}

Note that the signature of the funciton does not match at all. The first parameter is "casted" automatically to a different data type, which only works because pointers always have the same size and the second paramter is omitted completely. This only works because of the C calling convetion. C can be a strange land ;-)

Kind Regards
Benjamin Thaut

Reply via email to