[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Re: [Gm2] ISO exceptions source
From: |
Martin Kalbfuß |
Subject: |
Re: Re: [Gm2] ISO exceptions source |
Date: |
Wed, 23 Sep 2009 11:48:51 +0200 |
Am Mittwoch, den 23.09.2009, 09:48 +0100 schrieb Gaius Mulley:
> EXCEPTIONS.AllocateSource(Source);
Thanks. I will have a look at it. When my code is OK then I think I
found a bug.
I switched on -Wpedantic
PROCEDURE VectorAddition(Vector1, Vector2 : ARRAY OF REAL;
VAR Result : ARRAY OF REAL);
VAR
Index : CARDINAL;
Source : EXCEPTIONS.ExceptionSource;
BEGIN
IF HIGH(Vector1) <> HIGH(Vector2) THEN
EXCEPTIONS.RAISE(Source, 1, 'Error: Vectors of different
size');
END;
FOR Index := 0 TO HIGH(Vector1) DO
Result[Index] := Vector1[Index] + Vector2[Index];
END;
END VectorAddition;
--and he tells me:
src/VectorMath.mod:39:2: error: variable (Source) is being used but is
NEVER initialized in (VectorAddition)
--Another warning I get is:
src/VectorMath.def:10:26: warning: unused parameter (Result) in
procedure (VectorAddition)
--And the implementation is:
PROCEDURE VectorAddition(Vector1, Vector2 : ARRAY OF REAL;
VAR Result : ARRAY OF REAL);
VAR
Index : CARDINAL;
Source : EXCEPTIONS.ExceptionSource;
BEGIN
IF HIGH(Vector1) <> HIGH(Vector2) THEN
EXCEPTIONS.AllocateSource(Source);
EXCEPTIONS.RAISE(Source, 1, 'Error: Vectors of different
size');
END;
FOR Index := 0 TO HIGH(Vector1) DO
Result[Index] := Vector1[Index] + Vector2[Index];
END;
END VectorAddition;
Isn't allocating a global exception source incompatible with parallel
processes because they could raise two exceptions in parallel and would
use the same source?