• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

maximum no of arguments passed to a function.

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic