Small prob in juce_PNGLoader.cpp

Hi Jules,

the juce_loadPNGImageFromStream () function is defined as throw(), so it cannot throw/catch exceptions later in the try-catch block. Throw() doesn’t do much anyway, at least with VC, so maybe it can be “thrown out”.

As I understood it, making a method “throw()” doesn’t stop you using exceptions inside it, it just means that it won’t throw any itself, right?

(An in fact, throw() does have a very big effect in VC - when I first went through and added it to all the simple methods in the library, the demo executable shrank by about 20%!)

[quote=“jules”]As I understood it, making a method “throw()” doesn’t stop you using exceptions inside it, it just means that it won’t throw any itself, right?

[/quote]

TBH, I’m not sure. But my VC9 complains that the catch block is unreachable.

That’s odd, I’ve never seen that in VC2009… Which block exactly does it complain about?

Both, actually. I get 3 warning messages (C4702: unreachable code) for all three lines in the 2 catch blocks.

Well, that’s not because the outer function is declared throw(), it’ll be because the blocks only contain calls to C functions. Funny thing is, I must have put them in because of some sort of crash I’d seen in the png code, so that’s all a bit puzzling…

Okay, that may be. The good thing is that you know about it :slight_smile:

It’s not a big deal at all, though I always prefer to avoid compiler warnings if possible.