comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Strict aliasing, is it OK?
Date: Tue, 04 Jul 2017 22:41:48 +0100
Date: 2017-07-04T22:41:48+01:00	[thread overview]
Message-ID: <lya84j3mn7.fsf@pushface.org> (raw)
In-Reply-To: ojgkec$12cu$1@gioia.aioe.org

Victor Porton <porton@narod.ru> writes:

>    type My_Dummy_Access is access constant RDF.Auxiliary.Dummy_Record;
>
>    function C_Raptor_Parser_Get_Description (Parser: Handle_Type) return My_Dummy_Access
>       with Import, Convention=>C, External_Name=>"raptor_parser_get_description";
>
>    function Get_Description (Parser: Parser_Type) return RDF.Raptor.Syntaxes.Syntax_Description_Type is
>       function Conv is new Ada.Unchecked_Conversion(My_Dummy_Access, RDF.Raptor.Syntaxes.Syntax_Description_Type);

(I _wish_ you could use shorter lines!)

Is an "RDF.Raptor.Syntaxes.Syntax_Description_Type" actually an "access
constant RDF.Auxiliary.Dummy_Record"? If so, why not just declare
C_Raptor_Parser_Get_Description as returning a
RDF.Raptor.Syntaxes.Syntax_Description_Type? And if not, what are you
doing returning an unchecked conversion of one to the other?

Your code as it stands is equivalent to

   function C_Raptor_Parser_Get_Description
     (Parser : Handle_Type)
     return RDF.Raptor.Syntaxes.Syntax_Description_Type
      with
        Import,
        Convention => C,
        External_Name => "raptor_parser_get_description";

  parent reply	other threads:[~2017-07-04 21:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-04 17:49 Strict aliasing, is it OK? Victor Porton
2017-07-04 17:50 ` Victor Porton
2017-07-04 18:06 ` Victor Porton
2017-07-04 18:15 ` Niklas Holsti
2017-07-04 18:30   ` Victor Porton
2017-07-04 19:29     ` Niklas Holsti
2017-07-04 20:11       ` Victor Porton
2017-07-04 20:13         ` Victor Porton
2017-07-04 21:41 ` Simon Wright [this message]
2017-07-04 23:39   ` Victor Porton
2017-07-05  9:49     ` Simon Wright
2017-07-08 17:29     ` Robert Eachus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox