On 01/30/2015 02:06 PM, Savolainen, Petri (NSN - FI/Espoo) wrote:


-----Original Message-----
From: ext Taras Kondratiuk [mailto:taras.kondrat...@linaro.org]
Sent: Friday, January 30, 2015 1:50 PM
To: Savolainen, Petri (NSN - FI/Espoo); ext Ola Liljedahl
Cc: lng-odp@lists.linaro.org
Subject: Re: [lng-odp] Handling xxx_INVALID handles

On 01/30/2015 01:15 PM, Savolainen, Petri (NSN - FI/Espoo) wrote:
As explained below, XXX_NULL != XXX_INVALID enables to distinguish this
error ...

x = odp_xxx_create(...);      // error! => Returns XXX_INVALID
y = odp_yyy_create(x, ....);  // x == XXX_INVALID => error!

Deferring error detection to a second function doesn't look like a good
practice. It will be harder to determine a cause of the error then.

The "error!" mains any, undefined error (e.g. crash). It's an example of an 
error, another would be this.

x = XXX_INVALID; //init

// forgot to set x with valid value

y = odp_yyy_create(x, ....);  // x == XXX_INVALID => error!



Also 'x == XXX_INVALID => error!' is not a correct statement.
We agreed that 'x == XXX_INVALID => *undefined behavior*', so this is a
definitely a bad example.

Error! == undefined error, crash!

'Undefined behavior' means not only error return or crash, but it can silently succeed and mess some unrelated stuff. So application will crash later in some random place. Do you want to promote such API usage?

Sorry, but I'm really missing your point.

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to