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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: Victor Porton Newsgroups: comp.lang.ada Subject: Re: Unchecked_Union record inside an other record - trouble Date: Fri, 08 Aug 2014 23:01:30 +0300 Organization: Aioe.org NNTP Server Message-ID: References: <53e52322$0$32389$862e30e2@ngroups.net> NNTP-Posting-Host: AnnUDmZwVERVUXyHDyOl5A.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@aioe.org User-Agent: KNode/4.12.4 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:21574 Date: 2014-08-08T23:01:30+03:00 List-Id: Per Sandberg wrote: > You shall not try to write interface code by hand you shall use the > compiler > gcc -c -fdump-ada-spec > see GNAT Users guide. > > Since humans makes a heap load of errors and erronous asumptions when > they try to translate the contents of a .h file to an .ads file, the > compiler does a much better job. I considered this approach but refused to use auto-generated code. One reason is that it uses a system address type where it should be access arguments to a function. In my opinion, this is not guaranteed to work by ARM. The other reason is that I can fine tune types. One especially useful usage pattern is that I sometimes pass char_array and sometimes chars_ptr to a function which requires a char or a void pointer. Also I can differentiate "access" arguments and pass-by-value, what is a sometimes useful distinction. This use case simplifies my coding probably more that the necessity to write imported C functions manually. And last it does not take really much time to code imported C functions manually. I may make errors here, but as for now I've instead found a few errors in the C library with which I am trying to interface. -- Victor Porton - http://portonvictor.org