delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/21/12:55:56

From: Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How to convert mode to "pointer to array"?
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <i4tgnssvoqtig7t83jikf498cev6mpqab4@4ax.com>
References: <39780BA1 DOT 7354F5D2 AT umist DOT ac DOT uk>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 25
X-Trace: /Kw5eDKp8omycOISbQpEZ819GZ9QHiJzmCZizuwd+PEF2JYE/B6vsBGqyq2zLry6nRd3CVXnacBQ!gzR6dCKj1YL2peb3w8icZeZX9+gzqqNcOqiJ4ngooXJC7hzAbhNDNu33R6Ckqax2DDFFF4ARMH6i!68gJ
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Fri, 21 Jul 2000 16:06:35 GMT
Distribution: world
Date: Fri, 21 Jul 2000 16:06:35 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Fri, 21 Jul 2000 09:36:49 +0100, Anthony Appleyard
<Anthony DOT Appleyard AT umist DOT ac DOT uk> wrote:

>I wrote a Gnu C++ program with this text in;-
>
>class atom{public: double x,y,z; char mat,vis; atom(){};
>    atom(xyz c,char m=0,char v=0){x=c.x; y=c.y; z=c.z; mat=m; vis=v;};
>
>atom((*C)[N+1][N+1])= /*HERE*/ malloc((N+1)*(N+1)*(N+1)*sizeof(atom));
>
>My Gnu C++ compiler accepts this, but moans that implicit conversion
>from void* to a pointer is non-ANSI, so I likely couldn't use that
>program text in my good old faithful Borland C++ 4.52 for Windows. To
>make this text ANSI, what should I insert at /*HERE*/ ?

In C++ you shouldn't be using malloc() and free() anyway, That's what
new and delete were designed for.

-- 
Damian Yerrick
"I refuse to listen to those who refuse to listen to reason."
See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html

This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses.  http://www.mcafee.com/

- Raw text -


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