[Csnd-dev] Csound Auxalloc return value
Date | 2017-08-03 18:41 |
From | Ed Costello |
Subject | [Csnd-dev] Csound Auxalloc return value |
Hi, Is there a reason why the Csound AuxAlloc function return value is void? Would it be possible to return the pointer to the auxp member of the AUXCH struct? I don’t think this would break anything that is already using it, and it could also save a line of code each time it is used, I just noticed in my hdf5 plugin I have stuff like this: csound->AuxAlloc(csound, sizeof(hsize_t), &dataset->chunkDimensionsMemory); dataset->chunkDimensions = dataset->chunkDimensionsMemory.auxp; csound->AuxAlloc(csound, sizeof(hsize_t), &dataset->maxDimensionsMemory); dataset->maxDimensions = dataset->maxDimensionsMemory.auxp; csound->AuxAlloc(csound, sizeof(hsize_t), &dataset->datasetSizeMemory); dataset->datasetSize = dataset->datasetSizeMemory.auxp; csound->AuxAlloc(csound, sizeof(hsize_t), &dataset->offsetMemory); dataset->offset = dataset->offsetMemory.auxp; Which could be halved in line count. Thanks Ed |
Date | 2017-08-03 21:17 |
From | jpff |
Subject | Re: [Csnd-dev] Csound Auxalloc return value |
Or you coul do 1 call to AxAlloc ad then 4 assignments si qiker On Thu, 3 Aug 2017, Ed Costello wrote: > Hi, > Is there a reason why the Csound AuxAlloc function return value is void? Would > it be possible to return the pointer to the auxp member of the AUXCH struct? I > don’t think this would break anything that is already using it, and it could > also save a line of code each time it is used, I just noticed in my hdf5 plugin > I have stuff like this: > > csound->AuxAlloc(csound, sizeof(hsize_t), &dataset->chunkDimensionsMemory); > dataset->chunkDimensions = dataset->chunkDimensionsMemory.auxp; > > csound->AuxAlloc(csound, sizeof(hsize_t), &dataset->maxDimensionsMemory); > dataset->maxDimensions = dataset->maxDimensionsMemory.auxp; > > csound->AuxAlloc(csound, sizeof(hsize_t), &dataset->datasetSizeMemory); > dataset->datasetSize = dataset->datasetSizeMemory.auxp; > > csound->AuxAlloc(csound, sizeof(hsize_t), &dataset->offsetMemory); > dataset->offset = dataset->offsetMemory.auxp; > > Which could be halved in line count. > Thanks > Ed > > |
Date | 2017-08-03 21:37 |
From | jpff |
Subject | Re: [Csnd-dev] Csound Auxalloc return value |
I cannot think of a good reason except it changes the API On Thu, 3 Aug 2017, jpff wrote: > Or you could do 1 call to AuxAlloc and then 4 assignments is quicker > > > On Thu, 3 Aug 2017, Ed Costello wrote: > >> Hi, >> Is there a reason why the Csound AuxAlloc function return value is void? >> Would >> it be possible to return the pointer to the auxp member of the AUXCH >> struct? I >> don’t think this would break anything that is already using it, and it >> could >> also save a line of code each time it is used, I just noticed in my hdf5 >> plugin >> I have stuff like this: >> >> csound->AuxAlloc(csound, sizeof(hsize_t), >> &dataset->chunkDimensionsMemory); >> dataset->chunkDimensions = dataset->chunkDimensionsMemory.auxp; >> >> csound->AuxAlloc(csound, sizeof(hsize_t), >> &dataset->maxDimensionsMemory); >> dataset->maxDimensions = dataset->maxDimensionsMemory.auxp; >> >> csound->AuxAlloc(csound, sizeof(hsize_t), &dataset->datasetSizeMemory); >> dataset->datasetSize = dataset->datasetSizeMemory.auxp; >> >> csound->AuxAlloc(csound, sizeof(hsize_t), &dataset->offsetMemory); >> dataset->offset = dataset->offsetMemory.auxp; >> >> Which could be halved in line count. >> Thanks >> Ed >> > |