> > > Fixing STR #2881 (Check image bounds before allocation) requires
> > > to check for failed memory allocation. Without exception handling,
> > > I believe the only way to do it is:
> > > =
> >
> > >   #include <new>
> > >   ...
> > >   array = new(std::nothrow) char[xxx];
> > >   if (!array) longjmp(xxx, 1);
> > > =
> >
> > > which violates the CMP because it uses the standard library and
> > > the std namespace.
> > > =
> >
> > > What should we do?
> >
> >
> > Can we just use malloc instead of new, then check whether we get a NULL
> > pointer or not?
> 
> Yes, but this would require to rewrite the deallocating code to use
> free() instead of delete, and make sure every possible instance is
> changed.


Ah, ok...

I don't think we should throw an exception, so if here's no other way to 
prevent new from throwing the exception, I guess we are forced down this route?

Anybody...?



SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to