473,748 Members | 2,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Program size limitation

AB
Hello all,

I heard once that there is a limitation on the number of lines of code
that a program can have when using C, but not for C++. Is this true?

Any ideas?

Jul 13 '06 #1
6 2709
AB wrote:
Hello all,

I heard once that there is a limitation on the number of lines of code
that a program can have when using C, but not for C++. Is this true?
Depends on your compiler.

--
Ian Collins.
Jul 13 '06 #2
"AB" <ab*****@gmail. comwrites:
I heard once that there is a limitation on the number of lines of code
that a program can have when using C, but not for C++. Is this true?

Any ideas?
The C standard imposes no specific limit on the number of lines either
in a translation unit or in a program. A compiler could impose such a
limit, I suppose, but there's no particular reason to do so (unless
it's a cripped demo). As far as I know, it's the same for C++.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jul 13 '06 #3
AB a écrit :
Hello all,

I heard once that there is a limitation on the number of lines of code
that a program can have when using C, but not for C++. Is this true?

Any ideas?
Some compilers (like MSVC 6.0 for instance) would have problems
when compiling sources with more than 65535 lines. This is due
to the debug information format that MSVC was using some years ago.

Other compilers have no practical limits, even if the OS can have some
limitations.

Gcc under windows (mingw) stops at more than 65535 relocations in an
object module. lcc-win32 had this limit some years ago but I took it
away, maybe mingw has done that too, I do not know.

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. 64 bits systems do not have that
limitation but may have others, since no one has implemented a full
64 bit virtual space yet.

jacob
Jul 13 '06 #4
"jacob navia" <ja***@jacob.re mcomp.frwrote in message
news:44******** *************@n ews.orange.fr.. .
AB a écrit :
>I heard once that there is a limitation on the number of lines of code
that a program can have when using C, but not for C++. Is this true?

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

--
Stephen Sprunk "Stupid people surround themselves with smart
CCIE #3723 people. Smart people surround themselves with
K5SSS smart people who disagree with them." --Aaron Sorkin
--
Posted via a free Usenet account from http://www.teranews.com

Jul 13 '06 #5
"Stephen Sprunk" <st*****@sprunk .orgwrites:
[...]
I am a little curious what happens when __line__ exceeds the range of
a long long, though...
(__LINE__, not __line__)

__LINE__ expands to

The presumed line number (within the current source file) of the
current source line (an integer constant).

(C99 6.10.8p1)

Presumably it could be an unsigned long long literal. I suppose an
attempt to use __LINE__ when the line number exceeds ULLONG_MAX would
invoke undefined behavior.

The "#line" directive can be used to change the presumed line number,
but:

The digit sequence shall not specify zero, nor a number greater
than 2147483647.

(C99 6.10.4p3)

That's not in a constraint, so attempting to use #line to set the
presumed line number to ULLONG_MAX would invoke undefined behavior.

I see this is cross-posted to comp.lang.c++; the C++ rules may be
different.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jul 13 '06 #6
In comp.lang.c++ jacob navia <ja***@jacob.re mcomp.frwrote:
: AB a ?crit :
: Hello all,
: >
: I heard once that there is a limitation on the number of lines of code
: that a program can have when using C, but not for C++. Is this true?
: >
: Any ideas?
: >

TI suspect the 4 GByte limitation is for "flat mode" with x86 architecture,
meaning un-segmented (all code in one s32-bit segment), as then the max
offset for EIP = 2^32 - 1.

-- Scott
==========
: Some compilers (like MSVC 6.0 for instance) would have problems
: when compiling sources with more than 65535 lines. This is due
: to the debug information format that MSVC was using some years ago.

: Other compilers have no practical limits, even if the OS can have some
: limitations.

: Gcc under windows (mingw) stops at more than 65535 relocations in an
: object module. lcc-win32 had this limit some years ago but I took it
: away, maybe mingw has done that too, I do not know.

: 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. 64 bits systems do not have that
: limitation but may have others, since no one has implemented a full
: 64 bit virtual space yet.

: jacob
Jan 24 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7885
by: Rick Brough | last post by:
I'm in the early stages of researching the migrating of an OLTP Oracle database (size 200+ GB) and still growing to PostgreSQL 8.x. Before I spend alot of time documenting the migration path, I'd like to know if there is a limitation to the size of a PostgeSQL database. If so, what is the limitation? Any feedback would be greatly appreciated Thanks, Rick
2
1817
by: Anurag | last post by:
This simple one beats me all ends up(sincerely). I have been doing DB2 UDB for some time now, reading a lot of good discussions in this forum, writing some answers, asking a lot more but this simple question has floored me completely. Either I pretend that I know or I could let the kowledgable ones pass on some wisdom to me :-) When we say that: (1) "CLP in Db2 V8.2 still imposes a limit of 64K on the stored proc size;
19
26747
by: Jerry | last post by:
I am wondering what is the maximum size of memory that malloc() could handle. Is there any limitation on that? Where am I supposed to get this kind of information? Thank you everybody.
5
7975
by: praveen | last post by:
Hello Folks; I am working in ASP.NET application. I would like to know how much characters ( OR How much Size?) I can keep in View State variable. I want the limitation in its size. Is there any way to change/set this view state value. Thanks in advance! Posted Via Usenet.com Premium Usenet Newsgroup Services
2
14344
by: Joseph Geretz | last post by:
I'm developing a Web Service using DIME to download and upload files from and to an IIS server. In order to increase the download filesize to unlimited, I have the following block in my App.config and Web.config files: <messaging> <maxRequestLength>-1</maxRequestLength> </messaging> The largest file I've downloaded is 70 meg and that's more than plenty for me. However, I'm finding that on upload, if I attempt to upload greater than
22
591
by: Vijay | last post by:
With the option strict On set..... Dim fs As FileStream = File.OpenRead(strFile) With fs Dim buffer(fs.Length) As Byte ' <--- Option Strict On disallows implicit conversions from 'Long' to 'Integer'. ' other stuff.. End With
6
405
by: AB | last post by:
Hello all, I heard once that there is a limitation on the number of lines of code that a program can have when using C, but not for C++. Is this true? Any ideas?
1
2045
by: amiben | last post by:
Hi everyone. I have an .asp file that is included in my sites pages which holds information in a string array. The array is so large that the include file is almost 900kb in size. Some array string items hold as much as 15,000 character long strings. Now, I have been getting error "800a03e9 out of memory" in some cases and I think it might be related to the include file's string array size. As anyone encountered something similar to...
4
2550
by: leegold58 | last post by:
Hi, Is there a "way around" the size limitation for Access? I'm thinking of something like spanning a huge table accross multiple databases... Something simple and that would preserve the integrity of the DB yet let me overcome the size limitation. Is there any best practice or technique?
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9381
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.