From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bc9bd88290383e6f X-Google-Attributes: gid103376,public From: Ted Dennison Subject: Re: C++ Should not be used for Medical Devices Date: 1997/01/20 Message-ID: <32E3E46E.167EB0E7@escmail.orl.lmco.com>#1/1 X-Deja-AN: 211123073 references: <3.0.32.19970119225145.006fce98@mail.4dcomm.com> <01bc06d4$04745ee0$198c71a5@dhoossr.iquest.com> content-type: text/plain; charset=us-ascii organization: Lockheed Martin Information Systems mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 3.0 (X11; I; SunOS 4.1.3_U1 sun4m) Date: 1997-01-20T00:00:00+00:00 List-Id: David C. Hoos, Sr. wrote: > > From: Macarthur Drake > > I am in the mist of completing a major piece of code in C++. However I > keep comming across a particularly difficult bug. Can you help? > > I am simply trying to declare a three D array: > > float objects[9000][10][10]; This looks more like C than C++ to me. By my reckoning that is about 7,200,000 bytes. > Dynamic allocation (as you suggest) is the solution to the run-time > problem. ... > float * * * objects; > objects = malloc ( > DIM_1 * DIM_2 * DIM_3 * sizeof (float) > ); Of course this doesn't just require that you have 7 Meg free on your machine. You must have 7 Meg free in one contiguous block! It is quite possible that this will run once, but crash when run later. If you do this, make sure to check for malloc failure! As for the compiler errors, it looks like your compiler is buggy. I sure hope this C program, compiled with a buggy C++ compiler, is not going to run in an actual biomedical device (or at least in one that will ever be pointed at me :-) ). -- T.E.D. | Work - mailto:dennison@escmail.orl.lmco.com | | Home - mailto:dennison@iag.net | | URL - http://www.iag.net/~dennison |