comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@escmail.orl.lmco.com>
Subject: Re: C++ Should not be used for Medical Devices
Date: 1997/01/20
Date: 1997-01-20T00:00:00+00:00	[thread overview]
Message-ID: <32E3E46E.167EB0E7@escmail.orl.lmco.com> (raw)
In-Reply-To: 01bc06d4$04745ee0$198c71a5@dhoossr.iquest.com


David C. Hoos, Sr. wrote:
> 
> From:    Macarthur Drake <drake@BME.RI.CCF.ORG>
> 
> 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          |




  reply	other threads:[~1997-01-20  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-19  0:00 C++ Should not be used for Medical Devices Dr. Robert Leif
1997-01-20  0:00 ` David C. Hoos, Sr.
1997-01-20  0:00   ` Ted Dennison [this message]
1997-01-23  0:00   ` Jim Chelini
1997-01-27  0:00 ` Stephen Bull
  -- strict thread matches above, loose matches on Subject: below --
1997-01-25  0:00 Dr. Robert Leif
1997-01-26  0:00 ` Matthew Heaney
1997-01-26  0:00 ` Robert Dewar
1997-01-27  0:00 Dr. Robert Leif
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox