On Fri, Aug 24, 2012 at 2:44 AM, Neil <[email protected]> wrote:
> Justin Lebar wrote:
>
>> %{C++
>> inline int32_t GetFoo() {
>> int32_t result;
>> nsresult rv = GetFoo(&result);
>> MOZ_ASSERT(NS_SUCCEEDED(rv));
>> return result;
>> }
>> %}
>>
>
> Alternative approach?
> inline int32_t Foo(int32_t result = 0) {
> GetFoo(&result);
> return result;
>
> }
I think it would be better to bake the default params into the IDL, if
we wanted that. 0 isn't always what you want.
But I also think that [infallible] should mean "always gives you a
result," so you shouldn't have to worry about what the default is.
I'd be OK doing
> inline int32_t GetFoo() {
> int32_t result = 0;
> nsresult rv = GetFoo(&result);
> MOZ_ASSERT(NS_SUCCEEDED(rv));
> return result;
> }
so that we never return uninitialized memory in release builds. 0 may
or may not be right, but it should be no worse than a random value!
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform