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,64691254fcf844dd X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Mon, 11 Apr 2005 08:37:59 -0500 From: "Steve" Newsgroups: comp.lang.ada References: Subject: Re: Translate from C Date: Mon, 11 Apr 2005 06:39:40 -0700 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original Message-ID: NNTP-Posting-Host: 24.22.63.157 X-Trace: sv3-1yJTr0d+nd3Zo79hSl4B1umcZzvW3SwMV7Kqmdp7fkW9gRPqS0+Edmp7OpqJAOR21e+NiyA72hAZ6SO!njgqFBr2l2VgKimhpO3UofSJucILXfpciGl4ahYjeUYpOvnGLlIwwggP8dBV X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:10376 Date: 2005-04-11T06:39:40-07:00 List-Id: First: It is very un-Ada like to blindly copy values fromone address to another in Ada. In Ada you tend to think of things at a higher level than C. Second: There are very rare cases where you do want to copy a block of memory from one address to another. In these cases there is a function in Interfaces.C.Pointers called "Copy_Array" that performs exactly this function. It would be better if you described the functionality you're looking for. We often see questions on this group along the lines of "This is how I do it in C, how do I do it the same way in Ada?". More often than not, the better question is "This is what I am doing in C, how do I do the same thing in Ada?". Often Ada provides a better way of doing things that results in fewer bugs making it past the compiler. Steve (The Duck) "Jean-Baptiste CAMPESATO" wrote in message news:pan.2005.04.09.19.30.30.254343@a2lf.org... > Hello, > I've this code in C : http://www.a2lf.org/util.c > and i want to translate it in Ada; > A friend tried : > procedure Copy > (Source : Address; > Destination : Address; > Bytes : Natural) > is > S : String (1 .. Bytes); > D : String (1 .. Bytes); > for S'Address use Source; > for D'Address use Destination; > begin > for I in S'Range loop > D (I) := S (I); > end loop; > end Copy; > > Do you think it's Ok ? > > Thanks.