Here is a snippet of AppleAudioBufferList 's official documentation (reference information on types of audio data) :
AudioBufferList
AudioBufferListHolds an array of variable-length AudioBuffer structures.struct AudioBufferList { UInt32 mNumberBuffers; AudioBuffer mBuffers[1]; }; typedef struct AudioBufferList AudioBufferList; FieldsmNumberBuffersThe number of AudioBuffer structures in the mBuffers array.mBuffersAn array of variable-length AudioBuffer structures.
AudioBufferListHolds an array of variable-length AudioBuffer structures.
struct AudioBufferList { UInt32 mNumberBuffers; AudioBuffer mBuffers[1]; }; typedef struct AudioBufferList AudioBufferList;
Fields
mNumberBuffersThe number of AudioBuffer structures in the mBuffers array.
mNumberBuffers
mBuffersAn array of variable-length AudioBuffer structures.
mBuffers
If mBuffersdefined as AudioBuffer[1], it does not have a variable length and, therefore, is mNumberBuffersimplicitly defined as 1.
AudioBuffer[1]
1
Am I missing something here or is it just nonsense?
Good, because C to C99 requires a nonzero array size.
mBuffers AudioBuffer*, .
AudioBuffer*
mBuffers AudioBuffer, mBuffers[x].
AudioBuffer
mBuffers[x]
AudioBuffer[1].
C99,
struct AudioBufferList { UInt32 mNumberBuffers; AudioBuffer mBuffers[]; };
(. C ?.)
, "struct hack" ( C99) " " (VLA). , "1" . , , . , 10 , :
AudioBufferList *a = malloc(sizeof (*a) + 9 * sizeof(AudioBuffer)); a->mNumberBuffers = 10;
, AudioBuffer , , , .
- , PostgreSQL,
// VARIABLE SIZED STRUCTURE
- . , , , , 1 mBuffers - . , realloc() , , , "" mBuffers, .
, , mBuffers[1] - . . , , .
mBuffers[1]
. ..
Source: https://habr.com/ru/post/1737038/More articles:C ++ Offset Bits - c ++Where to draw the line between efficiency and practicality - htmlASP.NET CSV Excel problem with strange characters - c #How to stop property values โโfrom an element tree stream in xaml? - compositionRails: Ruby debugger shows old code if I don't stop the server and start it again - listHow to write a performance test for a .Net application? - performanceIs it common practice to add keywords to html markup for SEO? - htmlCreating CMS Extensible by Plugins - Examples - phpWhy should I use PropertyProxyValidator? ASP.NET - validationWhat is the equivalent of Lua Twisted Python, Eventmachine for Ruby, NIO for Java, etc.? - twistedAll Articles