comp.lang.ada
 help / color / mirror / Atom feed
* type clash in Ada
@ 1996-05-01  0:00 nguyent
  0 siblings, 0 replies; 2+ messages in thread
From: nguyent @ 1996-05-01  0:00 UTC (permalink / raw)



Hi, I am new in Ada, and it is driving me nut for an error message: type clash 
in paramater to "="   Can someone please tell me what does this mean?




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: type clash in Ada
@ 1996-05-01  0:00 John Herro
  0 siblings, 0 replies; 2+ messages in thread
From: John Herro @ 1996-05-01  0:00 UTC (permalink / raw)



> Hi, I am new in Ada, and it is driving me
> nut for an error message: type clash 
> in paramater to "="   Can someone please
> tell me what does this mean?
     You're testing if one thing is equal to another, but what you have to
the left of the equal sign is not the same type as what you have to the
right of the equal sign.  For example, you can't write
   I : Integer;
   F : Float;
...
   if I = F then ...
However, it's possible to create different types in a way that's not
obvious to a beginner.  For example, if you write
   A : array(1 .. 10) of Integer;
   B : array(1 .. 10) of Integer;
then A and B have different types (even though it's not obvious to
beginners), and you can't write "if A = B then ..."  You would fix this by
writing
   type Ten_Integers is array(1 .. 10) of Integer;
   A : Ten_Integers;
   B : Ten_Integers;
or by writing
   type Int_Array is array(Integer range <>) of Integer;
   A : Int_Array(1 .. 10);
   B : Int_Array(1 .. 10);
and in either case you could then write "if A = B then ..."
     Ada's strong type checking often causes problems at compile time for
beginners, but this is an advantage, because other languages would catch
these errors only at run time, or not at all.
     If the above doesn't help you fix your problem, please post more of
your code, especially the declarations of the objects mentioned on both
sides of the = sign, and we'll be glad to help you.
     Once you get into Ada, you'll really like it, and you won't want to
program in anything else.  I know; I'm an enthusiastic convert!  Good
luck!
- John Herro
Software Innovations Technology
http://members.aol.com/AdaTutor
ftp://members.aol.com/AdaTutor




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-05-01  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-05-01  0:00 type clash in Ada nguyent
  -- strict thread matches above, loose matches on Subject: below --
1996-05-01  0:00 John Herro

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