harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorbjørn Ravn Andersen <thunderax...@gmail.com>
Subject Re: More helpful error messages
Date Mon, 27 Mar 2006 13:40:32 GMT
Geir Magnusson Jr wrote:

>   if ( A || B ) {
>      engineReset();
>      throw new DigestException( A ?
>                 "offset incorrect  = " + offset
>                 : "incorrect len value ");
> }

Please :)  That much trouble to avoid writing engineReset() twice?

if (A) {
  resetEngine();
  throw new DigestException("offset incorrect " + offset);
}
if (B) {
  resetEngine();
  throw new DigestException("incorrect len value " + lenValue);
}

In my opinion ?: should only be used if there is a very good reason for 
it, as it lowers readability for future maintainers.

-- 
  Thorbjørn  (who reads much more code than he writes ;)

Mime
View raw message