I landed bug 853548 on inbound today which makes the SetCapacity method of
nsTArray and InfallibleTArray return void.  Previously they used to return
a bool type with a value of true all the time (since these methods are
infallible) which could potentially cause code which checks the return
value of SetCapacity to compile successfully if the author used nsTArray
instead of FallibleTArray by mistake.  See bug 852838 for an example of
this footgun leading to a crash.

With this fix, now the compiler will catch you because you would be
checking the return value of a void function.

I hope that others will look into converting other similar nsTArray methods
to return void when they always return a true since allocation never fails
in nsTArray.

Cheers,
--
Ehsan
<http://ehsanakhgari.org/>
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to