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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c6e016ae58737f34 X-Google-Attributes: gid103376,public From: Roga Danar Subject: Re: win32ada design question/problem Date: 1998/11/27 Message-ID: <365F0CC4.36199B9D@XXX_nospam_stelnj.com>#1/1 X-Deja-AN: 416286437 Content-Transfer-Encoding: 7bit References: <364C5EDE.4F402D13@elca-matrix.ch> <364c90eb.10939677@SantaClara01.news.InterNex.Net> <36501A46.82C348D3@elca-matrix.ch> To: Mats.Weber@elca-matrix.ch Content-Type: text/plain; charset=us-ascii X-Trace: news1.exit109.com 912195063 27275 208.225.73.22 (27 Nov 1998 19:31:03 GMT) Organization: AlphaSoft, Inc. Mime-Version: 1.0 Reply-To: job_nospam@XXXalphasoft-inc.com NNTP-Posting-Date: 27 Nov 1998 19:31:03 GMT Newsgroups: comp.lang.ada Date: 1998-11-27T19:31:03+00:00 List-Id: I agree completely. The bindings I use are done in this way. Mats Weber wrote: > Tom Moran wrote: > > > Win32Ada is just a thin binding to that, and Windows (based on C) uses > > the equivalent of Unchecked_Access all over. You either swallow hard > > and do C-ish code with Ada syntax, or you hide it in a thicker > > binding. > > I disagree. Windows was written in C, as was UNIX, and the same problems > would appear in a UNIX binding if it were done the same way (using fancy > access types). > > I think the problem with this binding is the inappropriate use of > general access types, because: > > - they encourage using global declarations for the parameters (and this > is actually happening: see the examples), when using 'Unchecked_Access > would be far better. > > - they don't document what is actually being done, e.g. to pass a > string, you must pass an '(Unchecked_)Access to its first character, > which is definitely not the Ada way of doing things and could even be a > problem with an aggressive optimizer. > > I think a binding done with System.Address for pointers and strings, and > Interfaces.C.Int for integers, would be far better. It's the way thin > bindings were done in Ada 83 and it's a method that has always worked > fine and does not have the general access type approach's problems. --