-
Notifications
You must be signed in to change notification settings - Fork 375
Description
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 as void*:
Line 639 in 18a606e
| typedef void PaStream; |
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.