Xref: utzoo alt.sources.amiga:217 comp.sys.amiga.advocacy:2551 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!ditka!zorch!xanthian From: xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) Newsgroups: alt.sources.amiga,comp.sys.amiga.advocacy Subject: Re: Short Hello World Message-ID: <1991May5.011748.11595@zorch.SF-Bay.ORG> Date: 5 May 91 01:17:48 GMT References: <1991Apr30.213936.22878@ux1.cso.uiuc.edu> <1991May2.102554.8679@cs.umu.se> Sender: news@ditka.Chicago.COM (Pulitzer at ditka) Followup-To: comp.sys.amiga.advocacy Organization: SF-Bay Public-Access Unix Lines: 45 dvljrt@cs.umu.se (Joakim Rosqvist) writes: > [some boring C-code deleted] :-) > Ok, assembler strikes back with this: (56 codesize, 92 executable) > OpenLib=-408 > Output=-60 > Write=-48 > move.l 4.w,a6 > lea dos(pc),a1 > jsr OpenLib(a6) > move.l d0,a6 > jsr Output(a6) > move.l d0,d1 > lea hello(pc),a0 > move.l a0,d2 > moveq #12,d3 > jmp write(a6) > dos: dc 'dos.library',0 > hello: dc 'Hello World',10 > /$DR.HEX$ And a better example of how _not_ to program would be hard to find. You've managed, in a 15 line program, to include 3 "magic numbers" that are dependent on the release of dos.library, so that your code need not merely be reassembled for an operating system upgrade, but rewritten. Sprinkle an equivalent 20% fraction of bogosities into 100,000 lines of code, and you might as well throw it away and start fresh as try to port it to the next release. Doing the linker's job for it is _not_ a smart move, as the first three lines clearly demonstrate. If you are going to evade higher level languages to worship at the altar of code size and speed, you have to work _much_ harder than this to equal the high level language's relatively automatic maintainability advantage. Kent, the man from xanth.