In dechamps/FlexASIO@59f75ce, I introduced a severe bug (dechamps/FlexASIO#231) because I accidentally wrote:
Pa_GetStreamInfo(&stream)
Instead of:
It is very sad that the obviously wrong code was able to compile.
The reason why that code managed to sift through the cracks is because PaStream* is defined as void*:
The problem with void* is that any pointer can be implicitly converted to it, making it very type-unsafe. You could write the following and the compiler won't bat an eye:
int a;
Pa_GetStreamInfo(&a);
I believe it would be more developer-friendly to make PaStream a type-safe opaque type, for example:
typedef struct PaStream PaStream;
This change shouldn't break anyone as long as user code does not rely on PaStream specifically being an alias to void - which seems unlikely. If it does break it's a compile-time error so it shouldn't take anyone by surprise.
In dechamps/FlexASIO@59f75ce, I introduced a severe bug (dechamps/FlexASIO#231) because I accidentally wrote:
Pa_GetStreamInfo(&stream)Instead of:
Pa_GetStreamInfo(stream)It is very sad that the obviously wrong code was able to compile.
The reason why that code managed to sift through the cracks is because
PaStream*is defined asvoid*:portaudio/include/portaudio.h
Line 639 in 18a606e
The problem with
void*is that any pointer can be implicitly converted to it, making it very type-unsafe. You could write the following and the compiler won't bat an eye:I believe it would be more developer-friendly to make
PaStreama type-safe opaque type, for example:This change shouldn't break anyone as long as user code does not rely on
PaStreamspecifically being an alias tovoid- which seems unlikely. If it does break it's a compile-time error so it shouldn't take anyone by surprise.