delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/23/22:02:41

From: George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Answer to allocate memory for VAMPYR
Date: 24 Jan 1998 01:36:44 GMT
Organization: Oxford University, England
Lines: 24
Message-ID: <6abgjc$csf$1@news.ox.ac.uk>
References: <34C91654 DOT 77322958 AT iname DOT com>
NNTP-Posting-Host: sable.ox.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Fri, 23 Jan 1998 19:14:46 -0300 in comp.os.msdos.djgpp Alejandro
Martin Sanchez <alesan AT iname DOT com> wrote:

: void main(void)
: {
:     char *foo;

:     foo = new char [2000000L];
:     if (foo == NULL)
:     {
:         printf("Error: I can not allocate 2Mb\n");
:         return;
:     }
:     delete foo;
: }

`new' and `delete' are C++ keywords.  In C++ programs, the `main'
function *must* return an int.  If you compile with -Wall the compiler
will inform you of this, and tell you that it's changing the return
type to `int'.  If you don't use -Wall then the compiler will do it
anyway, but it just won't tell you about it.

-- 
george DOT foot AT merton DOT oxford DOT ac DOT uk

- Raw text -


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