Hello,
I tried to reduce a program I couldn''t compile. You'll see it below. I'm wondering if I made a mistake or if it's really a bug.
I found that the problem comes from : P_Vecteur = ^T_Vecteur = Nil; (Everything is fine if I suppress the "= Nil".) In other programs, this declaration doesn't cause any problem, even if P_Vecteur is the argument of a procedure (and here there is no problem until the last procedure). Is it something I should avoid ?
Here is the output of GPC :
./temp24_u2.pas: In procedure `Diffvecteurs': ./temp24_u2.pas:29: initial value is of wrong type gpc1.exe: c:/djgpp/bin/gpc.exe exited with status 1
or
it may say also : ./temp24_u2.pas: In procedure `Diffvecteurs': ./temp24_u2.pas:29: incompatible types in initialization ./temp24_u2.pas:29: initial value is of wrong type gpc1.exe: c:/djgpp/bin/gpc.exe exited with status 1
and from time to time :
Exiting due to signal SIGSEGV General Protection Fault at eip=00172911 ...
(GNU Pascal v 2.1 alpha (20020910) with DJGPP, on WindowsME)
****************************** Program temp24;
Uses temp24_u2;
Begin End. ****************************** Unit temp24_u2;
Interface
Type P_Vecteur = ^T_Vecteur = Nil; T_Vecteur(N:Cardinal) = Array [1..N] Of LongReal;
Implementation
Procedure AddVecteurs(Resultat,A,B:P_Vecteur); Var Taille : Integer; Tampon : P_Vecteur; Procedure Addition(Resultat,AA,BB:P_Vecteur); Var I : Integer; Begin For I := 1 To Taille Do Resultat^[I] := AA^[I] + BB^[I] End; Begin End;
Procedure DiffVecteurs(Resultat,A,B:P_Vecteur); Var Taille : Integer; Tampon : P_Vecteur; Procedure Soustraction(Resultat,AA,BB:P_Vecteur); Var K : Integer; Begin For K := 1 To Taille Do Resultat^[K] := AA^[K] - BB^[K] End; Begin End;
Begin End. ******************************