Question about Ada.Unchecked_Conversion

From: Eric Jacoboni (jaco_at_neottia.net)
Date: 10/29/04

  • Next message: Peter Hermann: "Re: decimal separator (international?"
    Date: Fri, 29 Oct 2004 14:46:54 +0200
    
    

    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
    

  • Next message: Peter Hermann: "Re: decimal separator (international?"

    Relevant Pages

    • Re: Question about Ada.Unchecked_Conversion
      ... despite readings of Barnes and ... > To illustrate my pb, let a String in which i want to count ...
      (comp.lang.ada)
    • Re: scrolling a textbox
      ... (244 readings * 6 minutes) ... string in to the textbox. ... > efficient to use SelText. ...
      (microsoft.public.vb.general.discussion)
    • Re: Variable Variables
      ... Animesh K wrote: ... the string in $a as a $-suffix to make a new dynamic variable. ... Can someone illustrate a practical use out of it? ... JDS Computer Training Corp. ...
      (comp.lang.php)
    • Re: use associative array to calculate average & SD
      ... Thanks for your reference again. ... Let me illustrate: ... $array[var1] #impossible because var1 is a string ...
      (comp.lang.perl.misc)
    • Re: Variable Variables
      ... Jerry Stuckle wrote: ... uses the string in $a as a $-suffix to make a new dynamic variable. ... Can someone illustrate a practical use out of it? ... I will stop taxing my brain on the use of variable variables:) ...
      (comp.lang.php)