Quando si chiede un comportamento indefinito comune in C , le persone a volte fanno riferimento alla rigida regola di aliasing. Di cosa stanno parlando?
Ho usato i sindacati prima comodamente; oggi sono stato allarmato quando ho letto questo post e ho scoperto che questo codice union ARGB { uint32_t colour; struct componentsTag { uint8_t b; uint8_t g; uint8_t r; uint8_t a; } components; } pixel; pixel.colour = 0xff040201; // ARGB::colour is the active member …
Questo è solo per soddisfare la mia curiosità. C'è un'implementazione di questo: float InvSqrt (float x) { float xhalf = 0.5f*x; int i = *(int*)&x; i = 0x5f3759df - (i>>1); x = *(float*)&i; x = x*(1.5f - xhalf*x*x); return x; } in ruggine? Se esiste, pubblica il codice. L'ho provato …
Nel suo recente discorso "Digitare la punzonatura nel moderno C ++" Timur Doumler ha affermato che std::bit_castnon può essere utilizzato per eseguire il bit di bit floatin un unsigned char[4]perché gli array in stile C non possono essere restituiti da una funzione. Dovremmo usare std::memcpyo attendere fino a C ++ …
We use cookies and other tracking technologies to improve your browsing experience on our website,
to show you personalized content and targeted ads, to analyze our website traffic,
and to understand where our visitors are coming from.
By continuing, you consent to our use of cookies and other tracking technologies and
affirm you're at least 16 years old or have consent from a parent or guardian.