Passing short value as parameter
Hi every1,
i have a function that accepts short as an argument:
failedcount (short responcode){
switch(responcecode){
case 1:
case 2:
case 3:
}
}
now i have a method that calls it:
create {
failedcount(3) --- here it says can't pass an int value
}
so if i do:
short abc = 3;
and then do failedcount (abc);
Thank you..
yep, about thirty in a switch
Quote:
Originally Posted by
Eranga
Actually using large number of case statements is bad practice,
In general, yes. Especially when we get code like: Code:
failedcount(3) // here it says can't pass an int value
but in my opinion building a lib that takes a list from a file ( or ram resident Collection ) and writes to a CharArrayOutputStream (${title}) would be of utility in acheiving the ability to build large switches.
Quote:
Originally Posted by
Eranga
I think. I've never comes with such a situation more that 10 cases in a single application. But I've found someones code which have 30 cases, and that's the longest I've seen so far.
That's about the max that I could maintain by hand, an automated tool would be needful at that point.