Bonjour à tous.
Voilà lorsque je provoque un débordement arithmétique dans un case, je n'arrive
pas à récupérer l'exception, pourtant si je fais un "out of range" dans un tableau une exception est bien levé.Voici mon programme ci dessous.
Quelqu'un pourrai m'expliquer ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 with Ada.Text_Io,Ada.Integer_Text_io; use Ada.Text_Io,Ada.Integer_Text_Io; procedure Hi is H:Character; I:Integer; Tab:array(1..8) of Integer; begin H:='a'; -- si on décommente ça léve bien une exception --I:=Integer'Last; --I:=I+1; case H is when 'a' => begin I:=Integer'Last; I:=I+1; Put(I); --Tab(9):=4; Si on enléve le com ça léve bien une exception exception when others => Put("Devrait Afficher Ceci, "); raise; end; when others => begin Put("Others"); end; end case; exception when others => Put("puis ceci ?"); raise; end;
Partager