comp.lang.ada
 help / color / mirror / Atom feed
From: Eric Jacoboni <jaco@neottia.net>
Subject: Question about Ada.Unchecked_Conversion
Date: Fri, 29 Oct 2004 14:46:54 +0200
Date: 2004-10-29T14:46:54+02:00	[thread overview]
Message-ID: <m2oeil3d4x.fsf@mac.scrogneugneu.org> (raw)

Hi

There is something i've probably not understood about
Ada.Unchecked_Conversion behavior, despite readings of Barnes and
RM95.

To illustrate my pb, let a String in which i want to count
various separators :

subtype T_Phrase is String(1..Lg_Max);
   
type T_S�parateur is (' ', Ht, Lf, ',' ,';', ':', '.', '?', '!');
for T_S�parateur'Size use Character'Size;

function Char_To_S�parateur is 
      new Ada.Unchecked_Conversion(Character, T_S�parateur);

Ma_Phrase : T_Phrase;

What i want to do is simply a test like this, in order to find
characters that are also separators:

if Char_To_S�parateur(Ma_Phrase(I)) in T_S�parateur then 
  ...
end if;

But this test always fails and i don't understand why. The logic seems
correct so i suppose it's a misunderstanding of Unchecked_Conversion?

Any clue?
-- 
�ric Jacoboni, n� il y a 1402497600 secondes



             reply	other threads:[~2004-10-29 12:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-29 12:46 Eric Jacoboni [this message]
2004-10-29 14:22 ` Question about Ada.Unchecked_Conversion Dmitry A. Kazakov
2004-10-29 14:26 ` Jean-Pierre Rosen
2004-10-29 15:15 ` Nick Roberts
2004-10-29 15:47   ` Eric Jacoboni
2004-10-30 10:23     ` skidmarks
2004-10-30 16:30       ` Nick Roberts
2004-10-30 17:18         ` Eric Jacoboni
replies disabled

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