String literals, ASCII vs UTF-8

Caolán McNamara caolanm at redhat.com
Tue Feb 28 12:38:01 PST 2012


On Tue, 2012-02-28 at 14:48 +0100, Lubos Lunak wrote:
> - with today's systems (overcommitting, etc.) it is rather pointless to guard 
> against allocation failures

Another scenario of possibly more usefulness than actually "running out
of memory" is being directed to allocate a lunatic string size by some
busted document during import which is physically impossible to allocate
on a given architecture e.g. a broken .doc or whatever which claims to
have strings of SAL_MAX_SIZE * sal_Unicodes. Those would currently throw
std::bad_alloc without going anywhere near actually attempting to
allocate memory.

>  Does somebody see a good reason not to just remove it?

Mine's a somewhat contrived scenario, probably better to use custom foo
in places like the filters where the whole import can be abandoned on
epic failure.

C.



More information about the LibreOffice mailing list