I have a static callback function like so:

Qt Code:
  1. void Coin3dScene::flythruCB(void *data, SoSensor *s)
  2. {
  3. MyFlythruData *locData = (MyFlythruData *)data;
  4. //etc...
  5. }
To copy to clipboard, switch view to plain text mode 

The "data" I pass to the function is a struct that references variables I need to access in the callback:

Qt Code:
  1. typedef struct
  2. {
  3. float *flyTimeLen;
  4. bool *flyLoop;
  5. } MyFlythruData;
To copy to clipboard, switch view to plain text mode 

set-up like so:

Qt Code:
  1. MyFlythruData *myflydata = new MyFlyData;
  2. myflydata->flyTimeLen = &FlyTime;
  3. myflydata->flyLoop = &FlyLoop;
To copy to clipboard, switch view to plain text mode 


My question: is it necessary to use pointers in the struct as I've done? The callback function is called 50 times/second; by passing pointers to variables rather than the variable itself, the function should operate more smoothly with less overhead, right?

But on the other hand, since the callback receives a pointer to data rather than just "data"... it's unnecesary to use pointers for the variables inside the struct... if I don't otherwise need to. right?