Guidelines for writing code when you get compile errors

 

Provide yourself with access to the Language Reference Manual which will show you how to write code when you don’t know the syntax.

 

The purpose of  the specification usefulStuff.ads  that we played with in class was to provide some new types and the ability to read and write them.  The advantage of putting them in a specification as we did is that multiple procedures and functions can use them with out having to re-define them and can pass them as parameters back and forth.  Specifications frequently also specify subprograms although this one didn’t.

 

Compile VERY VERY VERY frequently  (almost after every new line of code) so you can determine where your problems are.

 

Look at code examples on web page and copy relevant MODELS as comments into your code so that you can use them as models.  (Delete those lines AFTER the code compiles)

 

Formal  parameters in Ada subprograms MUST be named types.

Anonymous type declaration:  

      A: array(1..10) of integer;

Named type declaration:

     Type a_type is array(1..10) of integer;

     A : a_type;

 

 

Remember to use WITH statements to include necessary (related) packages and subprograms.

 

Use fully qualified references to the related packages and subprograms. 

 

Code examples discussed in class are available as .txt files

            usefulstuff.ads

            testUsefulStuff.adb

            testNumbers.adb

 

I will add a link to  Darren’s notes here when I get them from him

 

HOMEWORK  for Tuesday, September 12, 2006