Fixed compilation on compilers that use EDG C++ frontend#587
Conversation
… since EDG frontend thinks it's just plain float.
|
I'd prefer not to do assignment initialization of values, since that allows implicit conversions and silent truncation. Is the EDG frontend expecting that bug to get fixed? Initializing a value with another of the same type is a pretty common thing, and is the preferred way to initialize things by the C++ Core Guidelines, so I doubt OpenAL Soft would be the only thing affected by this. |
|
@daveedvdv sorry for mentioning you, but could you help us with EDG frontend bug related to initialization? |
I do not know about this bug, but besides this there is another bug in EDG (related to Intel Intrinsics). |
|
We opened EDGcpfe/21800 for this issue in 2019, no results yet from them... |
|
@kcat I doubt this will be fixed in EDG any time soon. What's the actual difference these syntax sugar for initialization? I don't think the implicit initialization is possible for SIMD vector types. |
|
I bumped the priority of EDGcpfe/21800. I'll try to get to it soonish... |
Please also look at EDGcpfe/24405. This is from the same situations with Intel Intrinsics. Thank you! |
|
Will do. (That one was not assign to me, but it looks related. So I took it over and bumped it as well.) |
As far as OpenAL Soft goes, the only time |
|
I checked in fixes for EDGcpfe/21800 and EDGcpfe/24405. They still need to work their way through our QA pipeline, of course. |
|
To me it looks like a bug of OpenAL. I'd definitely vote for merging the fix into OpenAL. P.S. I think pushing such"C++ish" style into a low-level library like OpenAL without real need is bad direction =( |
It's basic C++ syntax for variable initialization. It's using the value in the
The need comes from stricter type handling and better compile-time error checking. C is extremely lax with type conversions, which gets compounded by strict aliasing for pointers. C also has a lack of features regarding polymorphism and generic type encapsulation, requiring messy code (macros, unsafe casts, type erasure) to get such functionality. Before the switch to C++ I had to hope the compiler wouldn't mis-optimize various pieces of code because of type-punning (particularly around generic interfaces for the backends and effects, atomics, or dynamic storage), while at the same time I didn't want it to miss optimizations thinking two incompatible pointer types might alias. The "C++ish style" helps the compiler understand the intent of the code, more properly compile it, and be more prone to warn or error when it's being used incorrectly. I am careful to ensure the code's not doing work it shouldn't be in the core real-time/mixing functions, that performance-minded functions can optimize just as well as if written in C (if not better), and there's a balance between CPU/memory use and maintainable code for the rest. And I'm open to improvements in these areas where anyone spots an issue. |
I guess, the issue in EDG frontend was fixed. @kosumosu, @r-a-sattarov, can LCC compile the latest OpenAL without this fix? Maybe this can be closed? |
The Edison Design Group frontend used in MCST lcc compiler as well as Intel C++ compiler and some others. We faced a problem when lcc was complaining that "no suitable conversion function from "__m128" to "float"". It could not digest uniform construction of _m128 from another _m128 due to a bug in the EDG frontend.
So here I replaced uniform initialization of __m128 and __m128i with assignment.