comp.lang.ada
 help / color / mirror / Atom feed
From: Pascal Obry <pascal@obry.net>
Subject: Re: equal and not equal
Date: Thu, 01 Sep 2005 20:23:37 +0200
Date: 2005-09-01T20:23:40+02:00	[thread overview]
Message-ID: <4317472c$0$1719$8fcfb975@news.wanadoo.fr> (raw)
In-Reply-To: <8_GRe.43146$F23.516228@twister2.libero.it>

TC a ï¿œcrit :
> how translate = and /= for pointer use?
> and := ?

I bet you have a pointer to a data structure and want to use = or /= on
the content (and not on the pointer itself). Use .all.

   type PA is access String;
   A, B : PA := new String'("azerty");

   if A.all = B.all then
      ...

Also to assign a value to the pointer :

   A.all := (others => ' ');
   --  All char of A.all are set to space

Note that

   A.all := "qw";

Will raise Constraint_Error as A.all is 6 chars long not 2.
You can omit the .all if using a slice :

   A (1 .. 2) := "qw";

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



  parent reply	other threads:[~2005-09-01 18:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-01 17:36 equal and not equal TC
2005-09-01 18:02 ` Florian Weimer
2005-09-01 18:22   ` Björn Persson
2005-09-01 18:23 ` Pascal Obry [this message]
2005-09-02 15:20 ` Martin Krischik
2005-09-02 15:36   ` Martin Krischik
replies disabled

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