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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c370342fe303517b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!208.49.83.146.MISMATCH!uns-out.usenetserver.com!news.usenetserver.com!pc02.usenetserver.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: C Interface example References: <1170516037.435847.326440@p10g2000cwp.googlegroups.com> From: Stephen Leake Date: Sun, 04 Feb 2007 09:32:12 -0500 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:dS0L7f9NeAI+k9GXpqB53IIuB2c= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 8b0a845c5ee72759e00d422075 Xref: g2news2.google.com comp.lang.ada:8910 Date: 2007-02-04T09:32:12-05:00 List-Id: artifact.one@googlemail.com writes: > (vector.h) > > #ifndef VECTOR_H > #define VECTOR_H > > float *vec_addNf(float *, float *, unsigned int); > > #endif > > (vec_add.c) > > #include "vector.h" > > float *vec_add(float *va, float *vb, unsigned int ne) > { > unsigned int ind; > for (ind = 0; ind < ne; ++ind) > va[ind] += vb[ind]; > return va; > } > > Now what would be the most simple and portable way to write > a vector,ads and vector.adb file? Drop the C code entirely, and use SAL; http://stephe-leake.org/ada/sal.html That way, you get array length checks, and appropriate exceptions, rather than status, for singularities. -- -- Stephe