FloatVectorOperations::add src constness


#1

Just a quicky. Is there a reason why the FloatVectorOperations routine with this form:

static void JUCE_CALLTYPE add (float* dest, float* src, float amount, int numValues) noexcept;​

doesn't have the src marked as const? The docs say this will add a fixed amount to each src value and store it in dest. Surely for this op src doesn't need to change?


#2

Thanks! Yes, you're right, looks like a typo by whoever added that function (not me!) Will fix it right away!


#3

yep, but I can't build anymore if I use the 10.8 sdk. it seems that vDSP_vsadd did not have const argument before ?

/Applications/Xcode5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/vecLib.framework/Headers/vDSP.h:6699:1: Candidate function not viable: 1st argument ('const float *') would lose const qualifier

/Applications/Xcode5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/vecLib.framework/Headers/vDSP.h:6718:1: Candidate function not viable: 1st argument ('const double *') would lose const qualifier

(I'm fine using a later sdk personally, but for info)


#4

Ah yes, thanks. There are a few other places in the code where some constness had to be cast away to work around that. I'll do the same for this functions too.


#5

Great, thanks Jules!