[PD-dev] [ pure-data-Patches-3458347 ] spec2_sqrt~.c won't work in double precision, violates C99

SourceForge.net noreply at sourceforge.net
Fri Dec 21 01:29:44 CET 2012


Patches item #3458347, was opened at 2011-12-12 11:43
Message generated for change (Comment added) made by eighthave
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=3458347&group_id=55736

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: externals
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Hans-Christoph Steiner (eighthave)
Assigned to: musil (tmusil)
Summary: spec2_sqrt~.c won't work in double precision, violates C99

Initial Comment:
spec2_sqrt~.c includes type punning, which violates the C99 standard, breaks when t_float/t_sample are 64-bit doubles, and also breaks modern compiler optimizations.  Here's the compiler warning:

pd-extended/externals/iem/iem_spec2/src/spec2_sqrt~.c:28: warning: dereferencing type-punned pointer will break strict-aliasing rules


----------------------------------------------------------------------

>Comment By: Hans-Christoph Steiner (eighthave)
Date: 2012-12-20 16:29

Message:
I attached a patch that uses the standard C99-compliant technique for doing
this kind of type-punning.  It uses a union.

http://stackoverflow.com/questions/11442708/type-punning-and-unions-in-c

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=3458347&group_id=55736



More information about the Pd-dev mailing list