home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / msdos / programm / 9266 < prev    next >
Encoding:
Text File  |  1992-09-11  |  2.0 KB  |  80 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
  3. From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
  4. Subject: Re: BC++ Far new()
  5. Message-ID: <9225520.24060@mulga.cs.mu.OZ.AU>
  6. Sender: news@cs.mu.OZ.AU
  7. Organization: Computer Science, University of Melbourne, Australia
  8. References: <gin503.715957220@cdc835> <18j0e6INN8ju@usenet.INS.CWRU.Edu> <gin503.716024999@cdc835>
  9. Date: Fri, 11 Sep 1992 10:35:58 GMT
  10. Lines: 68
  11.  
  12. gin503@cdc835.cdc.polimi.it (Maurizio Sartori Masar) writes:
  13.  
  14. >bu254@cleveland.Freenet.Edu (Stephen Groundwater) writes:
  15. >
  16. >>
  17. >>char far *MyBuf;
  18. >>MyBuf=(char far *)new[100L];
  19. >>
  20. >>Voila, 100 bytes of far memory, the important bit is the L.
  21. >>
  22. >>Steve>
  23. >
  24. >Look this program :
  25. >
  26. >/**************************/
  27. >#include <stdio.h>
  28. >
  29. >void far * operator new( unsigned long size );
  30. >
  31. >int main ()
  32. >   {
  33. >   char far * alpcStringArray [10];
  34. >
  35. >   for (int i = 0; i < 10; i++)
  36. >      {
  37. >      alpcStringArray[i] = new (char[10000L]);
  38. >
  39. >      printf ("Array %i is %Fp\n", i, alpcStringArray[i]);
  40.  
  41. Don't you mean
  42.        printf ("Array %i is %Fp\n", i, & alpcStringArray[i]);
  43.             
  44. >      }
  45. >
  46. >   return (0);
  47. >   }
  48. >/**************************/
  49. >
  50. >Its output is :
  51. >
  52. >Array 0 is 1F2F:0792
  53. >Array 1 is 1F2F:2EA6
  54. >Array 2 is 1F2F:55BA
  55. >Array 3 is 1F2F:7CCE
  56. >Array 4 is 1F2F:A3E2
  57. >Array 5 is 1F2F:CAF6
  58. >Array 6 is 1F2F:0000
  59. >Array 7 is 1F2F:0000
  60. >Array 8 is 1F2F:0000
  61. >Array 9 is 1F2F:0000
  62. >
  63. >
  64. >So it uses near malloc() !
  65. >
  66. >How can I call far new() ??
  67. >
  68. >                    Maurizio
  69. >
  70. >--
  71. >  ))    ))    ))      ))))))    ))    )))))))      Maurizio Sartori Masar
  72. >  ))))))))  ))  ))   ))))))   ))  ))  ))    ))   gin503@cdc835.cdc.polimi.it
  73. >  )) )) )) ))))))))       )) )))))))) ))))))       Politecnico di Milano
  74. >  ))    )) ))    ))  ))))))  ))    )) ))    ))            ITALY
  75. -- 
  76. Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
  77. This .signature virus is a self-referential statement that is true - but 
  78. you will only be able to consistently believe it if you copy it to your own
  79. .signature file!
  80.