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,7547564584b3c77a X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: Problems with GLUT on NT and "deeper accessibility" Date: 1998/10/30 Message-ID: #1/1 X-Deja-AN: 406820102 Sender: bobduff@world.std.com (Robert A Duff) References: <3639682C.AA824493@ilt.fhg.de> <3639E95B.3CD1F79D@ilt.fhg.de> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1998-10-30T00:00:00+00:00 List-Id: Rolf Wester writes: > Could you or anyone else tell an Ada novice why the program does'nt work with > "access" but with "Unchecked_Access"? When I define my own "my_ac_GLfloat" in the > same way "ac_GLfloat" is defined in win32.gl it works with "access". The accessibility rules are intended to prevent dangling pointers, unless you use one of the Unchecked_... features. Mostly, these rules are checked at compile time, which means they are necessarily conservative. You were able to create a pointer of type my_ac_GLfloat using 'Access because that access type is nested inside the procedure -- it has the same lifetime as the object, so it's impossible to assign those pointers into globals. The type ac_GLfloat, OTOH, is more global -- if you could use 'Access to make a pointer of type ac_GLfloat pointing to a local, then when the procedure returns, that pointer could remain -- it's a dangling pointer. Note that if you tried to do a type conversion from my_ac_GLfloat to ac_GLfloat, you would get the same error, for the same reason. Does glLightfv save that pointer? If so, you had better not use 'Unchecked_Access -- you better move your data to a global place, or put it on the heap. It not, you can use 'Unchecked_Access. - Bob -- Change robert to bob to get my real email address. Sorry.