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,f348a8d7ddab6952 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Bug reports for Win32Ada Binding Date: 1996/08/31 Message-ID: #1/1 X-Deja-AN: 177632961 references: <01bb9466$01037740$24af1486@pc-phw.inel.gov> <01bb96cb$340fd180$24af1486@pc-phw.inel.gov> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-08-31T00:00:00+00:00 List-Id: In article <01bb96cb$340fd180$24af1486@pc-phw.inel.gov>, Paul Whittington wrote: > function WinError_HRESULT_To_ObjBase_HRESULT is new > Ada.Unchecked_Conversion (Win32.WinError.HRESULT,Win32.ObjBase.HRESULT); But both HRESULTs are integer types, and all integer types are inter-convertible using a normal type_conversion. (In fact, they're both derived from the same thing, so they're inter-convertible for that reason, too.) So you can say: X: constant Win32.ObjBase.HRESULT := CoCreateInstance(...); if FAILED(Win32.WinError.HRESULT(X)) then ... or: if FAILED(Win32.WinError.HRESULT(CoCreateInstance(...))) then ... No need for UNCHECKED conversion. (I assumed use_clauses above.) It seems strange to me that these two HRESULTs are two different types, though, rather than subtypes of the same type. Subtypes would be more convenient because no conversion is requied. But I haven't seen the whole thing, so I don't know why they designed it that way. - Bob