Structured Programming
Goto hell Goto : unconstrained jump Any jump in assembly Exists in C/C++
GOTO Considered Harmful "For a number of years I have been familiar with the observation that the quality of programmers is a decreasing function of the density of go to statements in the programs they produce. More recently I discovered why the use of the go to statement has such disastrous effects, and I became convinced that the go to statement should be abolished from all "higher level" programming languages (i.e. everything except, perhaps, plain machine code)." -Edsger Djikstra
A program Clear implementation of 4*(4 + 12)
A program Ugly implementation of 4*(99 + 43)
Block Block : List of instructions with 1 entry and 1 exit
Block Block : List of instructions with 1 entry and 1 exit Defined Entry conditions : Exit conditions : answer in r1
Structured Programming A block is structured If entry conditions met and no bugs, exit conditions will be met
Structured Programming A sequence of blocks are structured if exit conditions for block 1 match entry for block 2
Structured Programming Alternation is structured if both branches end at same location with same exit conditions
Structured Programming Iteration of a code block is structured
Structured Programming Any block can be used inside any other
Universality Any program can be written in structured format: