How to handle Out-of-Memory in Konqueror?

Luciano Montanaro mikelima at virgilio.it
Wed Feb 25 14:10:37 GMT 2004


On Wednesday 25 February 2004 13:59, Rolf Magnus wrote:
> On Wednesday 25 February 2004 11:12, Luciano Montanaro wrote:
> 
> > > First thing: I will have to catch the exception? Or is it enough to check
> > > for zero as return value from new() ?
> >
> > new always returns a valid pointer unless you use nothrow
> 
> Or unless - which is by default the case in KDE AFAIK - exceptions are 
> switched off through the compiler command line.

I suppose that is the case, but I have not verified it.

> 
> > (e.g. QString pippo = new(nothrow) QString(1000); will return 0 if the
> > space can't be allocated.)
> 
> No, that will produce a compile error ;-)
> And you don't really want to dynamically create QStrings.
>

Ok, I have chosen the wrong example and didn't really check what I was writing.
I'll be crucified in the canteen for that! :)

Luciano 




More information about the kde-core-devel mailing list