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,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,688b25ba856f42d7 X-Google-Attributes: gid103376,public From: "Nick Roberts" Subject: Re: question about functions (bis) Date: 2000/01/24 Message-ID: <388ce9c4@eeyore.callnetuk.com>#1/1 X-Deja-AN: 577162472 References: <8690s0$8tq$1@news.mgn.net> X-Original-NNTP-Posting-Host: da130d37.dialup.callnetuk.com X-Trace: 25 Jan 2000 00:09:40 GMT, da130d37.dialup.callnetuk.com X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: comp.lang.ada X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Date: 2000-01-24T00:00:00+00:00 List-Id: The 'nice' solution is simple: declare a temporary of the return type, pass its address to the hardware, and return it at the end of the function. function Add (Left, Right: in T) return T is Result: T; begin ASIC_Add(Left'Address,Right'Address,Result'Address); return Result; end; pragma Inline(Add); Couldn't be easier! Note the use of a 'pragma Inline' to (hopefully) help with speed (which I presume matters in this situation). With a bit of luck, the compiler will optimise reasonably. -- Nick Roberts http://www.adapower.com/lab/adaos "Pascal LEJEUNE" wrote in message news:8690s0$8tq$1@news.mgn.net... > ... > Finaly, my function ADD use a hardware component which do > the operation with the addresses (it's an asic which needs > to know on which variable the operation is done) : > > function ADD (A, B : in T) return T is > tmp : system.address; > begin > << find the address of the result (that's my problem !!) >> and > put it in a local variable (tmp) > > call a procedure which use directly the hardware : > proc (a'address, b'address, tmp); > end ADD; > > So, the problem is quite simple : the type T is a "numerical" type > on which it is normal to have operators ... but the hardware need > to have the address of the arguments and the address of the result !!!