home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / cplus / 16212 < prev    next >
Encoding:
Text File  |  1992-11-13  |  1.4 KB  |  33 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!pipex!warwick!bham!bhamvx!mccauleyba
  3. From: mccauleyba@vax1.bham.ac.uk (Brian McCauley)
  4. Subject: Re: 'new' syntax?
  5. Sender: usenet@rs6000.bham.ac.uk (USENET News Service)
  6. Message-ID: <1992Nov13.124612.1@vax1.bham.ac.uk>
  7. Date: Fri, 13 Nov 1992 12:46:12 GMT
  8. Lines: 21
  9. References: <1992Nov13.095152.26819@rs6000.bham.ac.uk>
  10. Organization: University of Birmingham
  11.  
  12. In article <1992Nov13.095152.26819@rs6000.bham.ac.uk>, pickerig@eee.bham.ac.uk (Mr. G. Pickering) writes:
  13. > I want to create an array of 'size' long**, is the correct syntax:
  14. >   long*** new_blocks = new (long**[size]);
  15. > I am having memory corruption problems and suspect this is not doing
  16. > what I really want.
  17. I have trouble with the new operator myself I normally give up trying to
  18. understand the syntax and use a local typedef.
  19. {
  20.   typedef long **longPtrPtr;
  21.   longPtrPtr *new_blocks = new longPtrPtr[size];
  22. }
  23. Possibly not the most elegant solution but at least it works.
  24. --
  25.     \\   ( )    No Bullshit!   |  Email: B.A.McCauley@bham.ac.uk
  26.  .  _\\__[oo        from       |  Voice: +44 21 471 3789 (home)
  27. .__/  \\ /\@    /~)  /[   /\/[ |    Fax: +44 21 625 2175 (work)
  28. .  l___\\      /~~) /~[  /   [ |  Snail: 197 Harborne Lane,
  29.  # ll  l\\    ~~~~ ~  ~ ~    ~ |         Birmingham, B29 6SS, UK
  30. ###LL  LL\\   (Brian McCauley) |   ICBM: 52.5N 1.9W                                                                       
  31.