List of Phobos functions that allocate memory?

Jakob Ovrum jakobovrum at gmail.com
Sun Feb 9 04:03:15 PST 2014


On Sunday, 9 February 2014 at 05:00:15 UTC, Marco Leise wrote:
> And static allocation isn't an exactly appealing option...
>
>   throw staticException ? staticException : (staticException =
>   new SomethingException("Don't do this at home kids!"));
>
> and practically out of question when you need to chain
> exceptions and your call stack could contain this line of code
> more than once, resulting in infinite loops in exception
> chains as a new bug type in D, that is fixed by writing:
>
>   catch (Exception e) {
>       throw (staticException ? (e.linksTo(staticException) ? 
> staticException.dupThenWrap(e) : staticException) : 
> (staticException = new SomethingException("Don't do this at 
> home kids!"));
>   }

This doesn't seem like a valid concern. Nothing stops you from
using a (standard) function to do that ugly boilerplate.


More information about the Digitalmars-d mailing list