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: dennison@telepath.com Subject: Re: win32ada design question/problem Date: 1998/11/18 Message-ID: <72vjpm$ui9$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 413279797 References: <364C5EDE.4F402D13@elca-matrix.ch> <364c90eb.10939677@SantaClara01.news.InterNex.Net> <36501A46.82C348D3@elca-matrix.ch> <36531538.483857@SantaClara01.news.InterNex.Net> X-Http-Proxy: 1.0 x14.dejanews.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Wed Nov 18 23:04:33 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.5 [en] (WinNT; I) Date: 1998-11-18T00:00:00+00:00 List-Id: In article <36531538.483857@SantaClara01.news.InterNex.Net>, tmoran@bix.com (Tom Moran) wrote: > >I think a binding done with System.Address for pointers and strings, and > >Interfaces.C.Int for integers, would be far better. > Why exactly is X'Address preferable to X'Unchecked_Access? > Having spent a fair amount of time in the past debugging/correcting > supposedly portable code that incorrectly assumed an access type was a > 'Address, I'm rather sensitive to this issue. Its preferable philosophicly when I don't know and don't *care* what type of object it points to, other than possibly its size. This is often the case in C bindings and OS calls. With access objects I have three choices: o Write one binding for each C-routine/passed object combination I will ever want to use. Clearly unacceptable. o Arbitrarily pick some dummy access type to use for the C-routine, and convert other accesses and addresses into it. In keeping with the C approach, but Evil. Can cause confusion for maintainers and other readers, and thus may cause bugs in the future. o Create and use some unconstrained data array access object. Not evil. But unchecked conversion or address_to_access_conversion is still required to get a value of this type. Careless attempts to dereference the pointer may cause problems due to lack of bounds information. Way more work than using Address. -- T.E.D. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own