This isn’t critical and it might have been fixed in later Juce releases. Unfortunately I can’t update to the latest tip right now, so, very sorry in advance if this problem has been already solved.
Actually, thanks to the cast I don’t get a warning neither.
What I forgot to metion is that I have “Smaller Type Check” enabled which is runtime , debug mode, check under VS2010
The exact error message is :
“Run-Time Check Failure #1 - A cast to smaller data type has caused a loss of data. If this was intentional, you should mask the source of the cast with the appropriate bitmask. For example: char c = (i & 0xFF); Changing the code in this way will not affect the quality of the resulting optimized code.”
Me neither. Sometimes it’s usefull to catch weird bugs…
Anyway, and just FYI, the same error goes off here :
in :
[code] /** Writes a unicode character to this string, and advances this pointer to point to the next position. */
void write (const juce_wchar charToWrite) noexcept
{
const uint32 c = (uint32) charToWrite;
Oh, well if it’s going to go off every time a number gets cast to a smaller size, then sod it, I’m not changing all that perfectly good code to avoid their false alarms. I’m sure there are lots of other places where it’ll be triggered too.
As far as I know, that’s the only places but as I said, it’s not too important. I just wanted to mention it, mainly in case there’s a nasty side effect at some point. Anyway, this runtime check isn’t turned on by default anyway so you may as well leave it like this …
“Type overflow” is not supposed to be turned on project-wide, the feature is mainly there for FIPS compliance and the prevention of attacks through code using malformed inputs.
Expecting JUCE to work with it turned on is quite frankly, unreasonable.
[quote=“TheVinn”]“Type overflow” is not supposed to be turned on project-wide, the feature is mainly there for FIPS compliance and the prevention of attacks through code using malformed inputs.
Expecting JUCE to work with it turned on is quite frankly, unreasonable.[/quote]
Well, I use juce a lot, both for audio, graphics, etc … in my app and except the 2 errors above, there’s no other error !