| delorie.com/archives/browse.cgi | search |
| Xref: | news2.mv.net comp.os.msdos.djgpp:6535 |
| From: | John Joseph Newbigin <079519 AT bud DOT cc DOT swin DOT edu DOT au> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Size optimizations? |
| Date: | Fri, 26 Jul 1996 08:52:19 +1000 |
| Organization: | Swinburne University of Technology |
| Lines: | 20 |
| Message-ID: | <Pine.OSF.3.91.960726084838.13558B-100000@bud.cc.swin.edu.au> |
| References: | <4ss0f2$l79 AT harborside DOT com> <4t0jqo$1a9a AT useneta1 DOT news DOT prodigy DOT com> |
| NNTP-Posting-Host: | bude.cc.swin.edu.au |
| Mime-Version: | 1.0 |
| In-Reply-To: | <4t0jqo$1a9a@useneta1.news.prodigy.com> |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
On 22 Jul 1996, Mr. Eric Domazlicky wrote:
> char array[64000];
>
> main() {;}
>
> seems to make the exe size 64000 bytes longer. I could be wrong but
> this seems to the case. The solution to this is of course to allocate
> the array dynamically by using malloc() or new calls.
>
What I use in Borland C++ (I know the B word) is
char *array=new char[array];
This works fine although I check that array is not NULL before using it.
I have not tried this yet in DJGPP bit I see no reason why it won't work.
I guess, you could also add an assertion to the line to make the program
abort if the array can't be allocated.
Newbs.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |