Maximum arguments in a function?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Maximum arguments in a function?

  1. #1
    Join Date
    Mar 2005
    Posts
    53

    Maximum arguments in a function?

    I have a function that has 66 parameters of which 13 are ByVal and the rest are ByRef arguments.

    This function is producing the error "Too Many Arguments".
    WHat is the maximum I can pass? Is there a max on byval or byref values?

    Thanks,
    Ninel

  2. #2
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    66 parameters??? whow man... don't do that, a method with more than 10 parameters is always very hard to use! (and makes very easy to do mistakes)

    Group your parameters in a UDT, or even better in a Class, and pass that as argument

    Marco
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

  3. #3
    Join Date
    Sep 2006
    Posts
    3
    Agreed - A class is the best way to go about it. But a TYPE may offer some advantages if you ever want to save any of that data to disk.

  4. #4
    Join Date
    Aug 2004
    Location
    The hills of Virginia
    Posts
    29
    If it's possible to load the parameters into an array, that might be a quick & dirty approach, of course you loose the option to pass in individual values ByVal or ByRef. . .
    Jeff

  5. #5
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    array does not work if the types of the parameters are different.
    with the UDT everything will be passed byRef, but the usage of UST is restricted (can't be passed as argument to class, I do not remember on which condition because I use UDT only for private local data storage)
    with a class it is possible to have some sort of read only properties (that act as byVal parameters)
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

  6. #6
    Join Date
    Aug 2004
    Location
    The hills of Virginia
    Posts
    29
    Like I said, it's a quick and dirty, of course, when dealing with 66 parameters, I would say there are some design issues. . .
    Jeff

Similar Threads

  1. Getting a GUI to run
    By Eric in forum Java
    Replies: 4
    Last Post: 04-14-2006, 09:09 AM
  2. Packed Data(Comp-3, etc)
    By Marcos in forum VB Classic
    Replies: 3
    Last Post: 01-25-2006, 11:18 AM
  3. Getting a list of files into an array
    By Scott in forum VB Classic
    Replies: 12
    Last Post: 12-21-2001, 04:21 PM
  4. Getting a GUI to function
    By Eric in forum Java
    Replies: 1
    Last Post: 11-27-2001, 06:53 AM
  5. Trying to print a PDF File from VB
    By Kunal Sharma in forum VB Classic
    Replies: 2
    Last Post: 04-25-2000, 03:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center