samedi 30 juillet 2016

Function that only works if you pass in a NULL pointer? [on hold]

This is all the SDK documentation that I was given, which really isn't much.

DESCRIPTION - Connects to the bus with the given 'name'.

typedef void* BusId
Bus_Connect(BusId *bus, char *name, int port);

The API function call will only work properly if I pass in a NULL pointer.

int result;
BusId busName = 0;    //connection error if just BusId busName;
char *testName = "A";
int port = 1;

result = Bus_Connect(&busName, testName, port);   

I thought maybe the function is doing a NULL check, but that would mean it would error if you passed in a NULL. But this is the reverse case, where it only works when the pointer is NULL.

Any ideas why this is?

Aucun commentaire:

Enregistrer un commentaire