Re: maximum number of dimensions in C/C++ array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andre,

I have not run into the number-of-dimension limit of the compiler.

But I've never tried 8 (or more) dimensions!

I don't think the ISO 9899:1999 (C99) or ISO 9899:1989 (C89) have limits on
the number of dimensions.  I presume the only constraint is available memory
for your architecture.

Calculate out how many bytes of storage your technique will utilize:
sizeof(double) * n1 * n2 * n3 * n4 * n5 * n6 * n7 * n8;
Is that within the constraint of your platform?  For instance, PC-DOS that
limit would be 65536 bytes.

Also note:  putting arrays (or any sort of data) in header files is strongly
discouraged.  If two different source files include that same header file,
each translation unit will get its own copy of that data.  Header files are
for declarations of things (no storage reserved), not definitions of things
(bytes of code or data allocated).

Also, as mentioned already, putting large arrays on the stack is
discouraged, because the stack is usually significantly smaller than the
heap (or in C++ lingo, the global store).

Sincerely,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux