Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

maximum no of arguments passed to a function.

 
pavanasree vasireddy
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello everybody,

I would like to know the maximum no of parameters i can pass in a function.
Is there any limit? I would also like to know the maximum no of dimensions a multi dimensional array can have? Please clarify.


Thanks
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like the answer for both the questions in 255 (in Java 1.4 at least).

If I pass more than 255 arguments to a method I'm getting


And if I pass declare an array with more than 255 dims, I get

[ September 06, 2004: Message edited by: Mani Ram ]
 
pavanasree vasireddy
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. got clarified and i have another question. what would be the suggestable number when you pass parameters. Does it affect performance? what all factors get affected?

Thanks once again.
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say, if you are passing anything more than 10 parameters, then there is something seriously wrong with the design (this number might differ from person to person, but I think no one will suggest anything more than 10 - personally I never had a situation to pass more than 6 parameters)

I think it might cause some performance issues, but I'm not sure. You can test it yourself and see the difference.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mani Ram:
I would say, if you are passing anything more than 10 parameters, then there is something seriously wrong with the design (this number might differ from person to person, but I think no one will suggest anything more than 10 - personally I never had a situation to pass more than 6 parameters)
Close The "correct" maximum number is 7 plus or minus two; see this discussion. (Of course it's overly simplistic, but when push comes to shove I am quite serious).

- Peter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic