delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/08/05:05:46

From: "Michael Stewart" <mike AT reggin DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: malloc() problem
Date: Tue, 8 Jun 1999 09:22:00 +0100
Organization: (Posted via) Netcom Internet Ltd.
Message-ID: <7jijjm$7on$1@taliesin.netcom.net.uk>
References: <l03130302b382017d4008@[145.98.116.75]>
NNTP-Posting-Host: hgty.capgemini.co.uk
X-Trace: taliesin.netcom.net.uk 928829878 7959 194.42.240.2 (8 Jun 1999 08:17:58 GMT)
X-Complaints-To: abuse AT corp DOT netcom DOT net DOT uk
NNTP-Posting-Date: 8 Jun 1999 08:17:58 GMT
X-Newsreader: Microsoft Outlook Express 4.72.3155.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
Lines: 16
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Dlanor Blytkerchan wrote in message ...
>bufferType *buffer;
>bool rc = true;
>
>rc = ((buffer = (bufferType*)malloc(sizeof(bufferType))) != NULL);
>if (!rc) {
>  start complaining and quit..
>} // if


Are you compiling a C or C++ ? (bool and true are C++ keywords)
If you are indeed using C++ then consider allocating the structure with new.

Mike


- Raw text -


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