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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,fc35bf7ba6fca42d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!z14g2000cwz.googlegroups.com!not-for-mail From: "fabio de francesco" Newsgroups: comp.lang.ada Subject: Re: "new" word Date: 16 Mar 2005 04:53:41 -0800 Organization: http://groups.google.com Message-ID: <1110977621.005570.250420@z14g2000cwz.googlegroups.com> References: <1110966980.482176.111570@f14g2000cwb.googlegroups.com> NNTP-Posting-Host: 82.49.51.212 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1110977626 25276 127.0.0.1 (16 Mar 2005 12:53:46 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 16 Mar 2005 12:53:46 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: z14g2000cwz.googlegroups.com; posting-host=82.49.51.212; posting-account=Lp02jQ0AAABMd3TAghNf0TM2YBZqD_JE Xref: g2news1.google.com comp.lang.ada:9474 Date: 2005-03-16T04:53:41-08:00 List-Id: Larry Kilgallen wrote: > In article <1110966980.482176.111570@f14g2000cwb.googlegroups.com>, "fabio de francesco" writes: > > Ciao, > > > > While reading "the big online book of Linux Ada programming", by Ken O. > > Burtch, I stopped at the following assertion > > (http://www.pegasoft.ca/resources/boblap/13.html): > > > > "Usually you allocate memory with the Ada new statement. Where does new > > get its memory? It uses the standard C library's malloc function." > > > > Does really Ada use Libc to implement "new"? Is it true? > > Of course not. Ada is a language standard, and allocates memory out of > thin air. That memory has no physical reality and costs nothing. It is > unlimited in size. Your sarcasm is totally inopportune. Maybe you don't even know the difference between what is provided by the OS and what comes from the Standard C Library. Standard C Library provides memory to C user programs through asking pages to the kernel, that is malloc -> brk -> (assembly code) int h80 -> sys_brk(C code in kernel). So what forbids to whichever Ada implementation to directly ask memory to the kernel the same way LibC does? > Some particular Ada _implementation_ however, has to deal with physical > memory. It is possible that some implementation might be layered on top > of the C memory allocation facilities. > > > It seems absurd to me. I don't understand why Ada should depend on a C > > standard library. > > Some operating systems are very C-centric in their operating system calls, > and without direct experience I would say that Linux is likely one of them. > I have seen "portable" C programs which spend half of their lines of code > rolling their own version of facilities that are built into other operating > systems. What has it got to do with the question? While kernel is written with C, if you want to use a syscall from user space you have to issue a software interrupt in a standardised way (see syscalln() macros) to access kernel space. So what would prevent an Ada implementation to call sys_brk using the very same technique? In theory Ada implementation doesn't need LibC, it only need to access kernel. Ciao, fabio de francesco