none
How many Number of Variable in VS2008? RRS feed

  • Question

  • In program development, we want to know the maximum number of variable for huge calculation.  If we need to use over 1 millions variable for holding number (long number, not float) for calculation, can VS2008 do it?  If yes, what is the maximum number of variable for development?

    Hoping to have your valuable comment, thanks.

    Dr. Ray Kong

    Saturday, January 28, 2012 4:20 PM

All replies

  • The following link will provide you with the information you need.  VS2008 has nothing to do with the capacity of the integer.

    http://en.wikipedia.org/wiki/Integer_(computer_science)

    Saturday, January 28, 2012 6:07 PM
  • Having an array dimensioned to 1,000,000 as a long, is perfectly fine.  Think of an application with two images of size 1000x1000.  That is basically the same size as your number of variables.
     
    I know of no limit on the number of variables (such as a, ab, abc, ...).  I can only comment that developing code with that many different variables would seem to take an insurmountable time to enter the source.  It would likely be a maintanance nightmare. 
     

    --
    Mike
    Saturday, January 28, 2012 6:13 PM
  • Long integers are 64 bits (i. e. 8 bytes) s if you have 1 million you need about 8Mbytes just to hold them. So if they are local then you need a stack at least that big. If they are fields in classes then they will go on the heap.

    But do you seriously need to hold 1 million values in memory at anyone time? What sort of calculations are these that require so many values?

     

    PS I think there is no predefined limit, it depends on the amount of memory available. But I don't know for certain.


    Regards David R
    ---------------------------------------------------------------
    Object-oriented programming offers a sustainable way to write spaghetti code. - Paul Graham.
    Every program eventually becomes rococo, and then rubble. - Alan Perlis
    The only valid measurement of code quality: WTFs/minute.
    • Edited by Riced Saturday, January 28, 2012 6:22 PM Added PS
    Saturday, January 28, 2012 6:18 PM
  • The Framework, or other 3rd party libraries, define the range of Value types.

    http://msdn.microsoft.com/en-us/library/exx3b86w.aspx  integral types

    http://msdn.microsoft.com/en-us/library/9ahet949.aspx  floating point types

    http://msdn.microsoft.com/en-us/library/364x0z75.aspx decimal type

    http://msdn.microsoft.com/en-us/library/dd268220.aspx  System.Numerics namespace (BigInteger and Complex value types)

    The C# specification defines certain keywords, which correspond to specific types in the .NET Framework

    http://msdn.microsoft.com/en-us/library/ya5y69ds.aspx  built-in types table

    I am not aware of any libraries that allow you to resolve values to one million decimal places.  Or did I misunderstand your question?

    Hope this helps.

    Rudy   =8^D


    Mark the best replies as answers. "Fooling computers since 1971."

    http://thesharpercoder.blogspot.com/

    Saturday, January 28, 2012 6:19 PM
    Moderator
  •   If yes, what is the maximum number of variable for development?

     

    Dr. Ray Kong


    Some collections, List and Arrays, use type Int32 as the index variable.  That class has a MaxValue property, like all integral types.

    http://msdn.microsoft.com/en-us/library/system.int32.maxvalue.aspx

    "The value of this constant is 2,147,483,647; that is, hexadecimal 0x7FFFFFFF."

    You will probably run out of memory long before you can create a collection that large.

    Rudy   =8^D


    Mark the best replies as answers. "Fooling computers since 1971."

    http://thesharpercoder.blogspot.com/

    Saturday, January 28, 2012 10:14 PM
    Moderator