Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!usc!ucsd!ucbvax!galileo.berkeley.edu!jbuck From: jbuck@galileo.berkeley.edu (Joe Buck) Newsgroups: comp.arch Subject: Re: RISC hard to program? (was: Moto's data predicts...) Message-ID: <37655@ucbvax.BERKELEY.EDU> Date: 19 Jul 90 19:08:19 GMT References: <3241@bnr-rsc.UUCP> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: jbuck@galileo.berkeley.edu (Joe Buck) Lines: 33 In article <3241@bnr-rsc.UUCP>, schow@bcarh185.bnr.ca (Stanley T.H. Chow) writes: >In article wsd@cs.brown.edu (Wm. Scott `Spot' Draves) writes: >>no way. A correctly written program will have no problems with >>alignment on any architecture. Can you give an example of correct >>code that will fail? (I am assuming that well written programs are >>correct :) > The problem is, of course, how do you define "correctly written > program". If you define code that are not portable as poorly > written, than your statement is meaningless. If the program, when run through lint, does not print "possible pointer alignment problem" except for pointer values returned by malloc, and does not generate any other lint messages, it will not crash when compiled on another architecture because of an alignment problem. C programs that are UNNECESSARILY non-portable are poorly written. Programs that blithely assume int, long, and pointers are the same thing out of programmer laziness or that throw casts around with abandon are poorly written. Sometimes machine-specific code is required. Such code should be isolated and commented well. Even if, when you write the program, you think it doesn't need to be portable, chances are at some point down the road you, or someone else, will need to port it. Either make this job easy, or leave your name off the code, because some future programmer will curse your name otherwise. -- Joe Buck jbuck@galileo.berkeley.edu {uunet,ucbvax}!galileo.berkeley.edu!jbuck