jacob navia said:
AB a écrit :
Of course there is the limitations of disk space (I think that above
1000 million lines your hard disk starts getting full) and there is some
limitations in executable size: under 32 bits systems you usually
can't have a program of more than 2GB size (2GB reserved for the
system) or at most 3GB... This surely puts a stop in the number of lines
of code your program can have.
Not true. Someone here recently posted an example of a program that had
thousands of lines of code, branches, computed gotos, functions, etc. that,
after optimization, resulted solely in the machine code equivalent of
"return 7;". It is a common beginner mistake to assume that source code
size has any relation to the output code size.
Also, even on 32-bit systems, there is no fundamental limit of 2GB or 3GB;
that's an implementation detail. There is at least one x86 Linux variant
that gives user code 4GB minus a few (4kB) pages for trapping NULL and for
switching to kernel page tables on a syscall. If that's not enough, the
implementation could implement overlays so that the actual program could
exceed 4GB, just not with all parts loaded at the same time. MS implemented
similar tricks in Windows for accessing parts of 36-bit PAE memory within
32-bit userland.
Even disk space is not a practical limitation, since one can always add more
disks to make bigger arrays and use multiple object files if a single object
would exceed a 64-bit filesystem.
The only practical limit is in how complex a program can get and still be
correct and maintainable.
64 bits systems do not have that limitation but may have others, since
no one has implemented a full 64 bit virtual space yet.
That's really no different than the 32-bit non-limits.
I am a little curious what happens when __line__ exceeds the range of a long
long, though...
S