CPSC 2310 - DAY 21 OCTOBER 24, 2016 =============================================================================== TWO-DIMENSIONAL ARRAYS ---------------------- storage allocation is now more difficult - row major or column major 0 1 2 +--+--+--+ 0| | | | +--+--+--+ 1| | | | +--+--+--+ (0,0) -+ (0,1) | row 0 (0,2) -+ ROW MAJOR ORDER (1,0) -+ (1,1) | row 1 (1,2) -+ (0,0) -+ column 0 (1,0) -+ (0,1) -+ column 1 COLUMN MAJOR ORDER (1,1) -+ (0,2) -+ column 2 (1,2) -+ C is row major, while FORTRAN is column major MULTIPLE ENTRY POINTS --------------------- Multiple entry points allow different function names, different parameter lists different parameters, etc. fn_ab: mov r0, #1 //default first parameter fn_b: mov r1, #2 //default second parameter fn: sum: add r0, r0, r1 //add parameters and return sum bx lr PASS BY VALUE ------------- .Use of the parameter without needing to load it from memory. PASS BY REFERENCE ----------------- .Must first load the value from memory (equiv. to dereferencing) before using it. SEPERATE ASSEMBLY ----------------- .seperate source files provide a nice structure for dividing a project among team members .minimize the work of reassembly and relinking when change occurs in only one source file .prewritten libraries provide machine extensions (ex. square root) *** by using gcc -Wall -c first.c, this means compile and don't link *** *** allows you to compile and test the syntax of one file, is not executable *** PROGRAM TESTING --------------- .BOTTOM-UP DEVELOPMENT .write and test the lowest-level (leaf) subroutines first, then write the modules or program that uses them .requires extra effort of writing drivers .TOP-DOWN DEVELOPMENT .write the highest level functions first and test the logic .requires extra effort of writing stub routines that are placeholders for lower level subroutines