That's good to know. Something seemed funny about that cast and I figure it was a left over while the other sample conversion functions were updated. It's probably one of those things that worked fine for a long time but was never explicitly allowed to work. Reminds me of parts of Pd. :)
I'm not super familiar with C++14 & C++20, so it's good to know. > On Feb 9, 2020, at 2:29 AM, [email protected] wrote: > > Message: 1 > Date: Sun, 9 Feb 2020 02:29:49 +0100 > From: Christof Ressi <[email protected] <mailto:[email protected]>> > To: [email protected] <mailto:[email protected]> > Subject: Re: [PD-dev] Tips on debugging dip crashes? > Message-ID: <[email protected] > <mailto:[email protected]>> > Content-Type: text/plain; charset="windows-1252"; Format="flowed" > >> by applying a union used in one part of the code to another to > replace a dereferencing cast > > Type punning via pointer casts often violates the "strict aliasing > rules" and the compiler might do wonky optimizations. Type punning via > unions, on the other hand, is explicitly allowed in C. It is *not* > allowed in C++, although in practice I haven't encountered a case where > it didn't work. (The legal way to do type punning in C++ has been > memcpy() , which gets fully optimized away; C++20 finally has > std::bit_cast()). > > You probably know this anyway. Just writing for other people who are > reading :-) > > Christof -------- Dan Wilcox @danomatika <http://twitter.com/danomatika> danomatika.com <http://danomatika.com/> robotcowboy.com <http://robotcowboy.com/>
_______________________________________________ Pd-dev mailing list [email protected] https://lists.puredata.info/listinfo/pd-dev
