ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/11/28/01:05:55

Date: Sun, 27 Nov 1994 20:37:02 -0500 (EST)
From: RDIBBLE AT delphi DOT com
Subject: Questions and Answers
To: djgpp AT sun DOT soe DOT clarkson DOT edu

>I was wondering what the exact differences betwen arrays and allocated pointers are.
>
>If you have:
>int array[big];
>
>array[i] = 1;
>
>or
>
>int * ptr
>ptr = new int[big];
>ptr[i] = 2;
>delete ptr
>
>they both do about the same thing, but the first case makes your exe bigger.
>I would think that the first case can be alot faster however.  Is this correct?

The reason that the first example is bigger is because it is static and if you viewed
the exe you could actually find the array.

Example: 
char *text = "Hello There World!"

You could search the exe file and find the text "Hello There World" in it.
However if you use _new_ :

char *text;
text = new char[19]

Then store some user input to it you could not search the file and find it.
(I say user input so as not to confuse you because if you have the text in
your source code chances are it will end up in the exe somewhere.)

As for speed I don't think that the difference would be that noticable.

And now for a question.
I've read the DOCs and I'm still unable to get some of the test and sample
programs in DJGPP to run. Specifically the "grtask" app it keep crashing
whenever I try to run it. Does anyone have any helpful hits?? Or a FAQ file
to look to? Also I'm unable to get the LIBGRX examples to compile. I can get
more specific but not in this letter. Thanks.

     Later,                  /----------------------------------------------- 
                             | There Are Those Who Make Things Happen,
          Ryan :)            | Those Who Watch Things Happen,
          rdibble AT delphi DOT com | And Those Who Wonder What Happened!
-----------------------------/
Geek Code v2.1 (finger hayden AT krypton DOT mankato DOT msus DOT edu for explaniation)
GE/MU d H s++:- g+ p3+ au- a-- w++ v(*)>!v C+++>++++ U P? !L !3 E?>++ N K- 
      W--- M-- !V +po-(---) Y+ t++ !5 j+ R++ G+++ !tv b++ D++ B--- e u++(+) 
      h! f+ r-- !n y?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019