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=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!uunet!snorkelwacker!mit-eddie!bbn.com!adoyle From: adoyle@bbn.com (Allan Doyle) Newsgroups: comp.lang.ada Subject: Re: C Strings in Ada? Message-ID: <57290@bbn.BBN.COM> Date: 11 Jun 90 19:59:38 GMT References: <920024@hpclapd.HP.COM> <920025@hpclapd.HP.COM> <1304@software.software.org> <57245@bbn.BBN.COM> Sender: news@bbn.com Reply-To: adoyle@vax.bbn.com (Allan Doyle) Organization: Bolt Beranek and Newman Inc., Cambridge MA List-Id: In article emery@linus.mitre.org (David Emery) writes: >Allan Doyle writes >>If I take the worst case assumption that c_string >>is being allocated from the heap and add it to the worst case assumption >>that my Ada run-time will not be doing garbage collection (perfectly legal, >>I understand), then how many of these little beasties can I convert from >>Ada to C before I run out of memory? > >It's not clear to me that you can guarantee with a C compiler that >there is not some compiler-generated heap, either. Does the C >LANGUAGE guarantee non-heap allocation for a local variable??? Or >does "everyone knows that's how it's done?" > > dave emery > emery@aries.mitre.org Touche' - I just looked in K&R and found no statement concerning automatic variables and the memory they occupy. It only states that the variables "disappear" from scope. By the way, the example I gave in the previous post: declare c_string : constant string := "foo" & ascii.nul; would take up heap in C as well. I really meant proc(foo: string) is c_string : constant string := foo & ascii.nul; ... which everybody "knows" will go on the stack in C...(sigh) Allan Doyle adoyle@bbn.com BBN Systems and Technologies Corporation (617) 873-3398 70 Fawcett Street, Cambridge, MA 02138