[PD-dev] Tips on debugging dip crashes?
Dan Wilcox
danomatika at gmail.com
Sun Feb 9 22:30:54 CET 2020
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, pd-dev-request at lists.iem.at wrote:
>
> Message: 1
> Date: Sun, 9 Feb 2020 02:29:49 +0100
> From: Christof Ressi <info at christofressi.com <mailto:info at christofressi.com>>
> To: pd-dev at lists.iem.at <mailto:pd-dev at lists.iem.at>
> Subject: Re: [PD-dev] Tips on debugging dip crashes?
> Message-ID: <f1514d4a-dc01-cb71-f271-98e53ca7a629 at christofressi.com <mailto:f1514d4a-dc01-cb71-f271-98e53ca7a629 at christofressi.com>>
> 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/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20200209/c7a21f5f/attachment.html>
More information about the Pd-dev
mailing list