comp.lang.ada
 help / color / mirror / Atom feed
From: Victor Porton <porton@narod.ru>
Subject: Re: Unchecked_Union record inside an other record - trouble
Date: Fri, 08 Aug 2014 23:01:30 +0300
Date: 2014-08-08T23:01:30+03:00	[thread overview]
Message-ID: <ls3aam$lnr$1@speranza.aioe.org> (raw)
In-Reply-To: 53e52322$0$32389$862e30e2@ngroups.net

Per Sandberg wrote:

> You shall not try to write interface code by hand you shall use the
> compiler
> gcc -c -fdump-ada-spec <more arguments and files>
> 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

  reply	other threads:[~2014-08-08 20:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08 15:36 Unchecked_Union record inside an other record - trouble Victor Porton
2014-08-08 16:01 ` Adam Beneschan
2014-08-08 16:56   ` Victor Porton
2014-08-08 18:52     ` Shark8
2014-08-08 19:56       ` Victor Porton
2014-08-08 20:06         ` Pascal Obry
2014-08-08 20:09         ` Shark8
2014-08-08 20:12           ` Victor Porton
2014-08-08 20:22             ` Shark8
2014-08-08 20:28               ` Victor Porton
2014-08-08 21:07                 ` Shark8
2014-08-08 19:52   ` Victor Porton
2014-08-08 19:57     ` Adam Beneschan
2014-08-08 19:21 ` Per Sandberg
2014-08-08 20:01   ` Victor Porton [this message]
2014-08-08 21:23   ` Jeffrey Carter
2014-08-10  7:25     ` Per Sandberg
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox