Path: utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!zaphod.mps.ohio-state.edu!ub!uhura.cc.rochester.edu!rochester!pt.cs.cmu.edu!o.gp.cs.cmu.edu!andrew.cmu.edu!rg20+ From: rg20+@andrew.cmu.edu (Rick Francis Golembiewski) Newsgroups: comp.sys.amiga.programmer Subject: Re: Good Programming stops guru |||| and BNF of C++ Message-ID: <8bXHP_y00VIFALti1O@andrew.cmu.edu> Date: 11 Jan 91 03:53:46 GMT References: <4381@mindlink.UUCP> Organization: Class of '92, Carnegie Mellon, Pittsburgh, PA Lines: 61 In-Reply-To: <4381@mindlink.UUCP> A Few trick that I have found to be very helpful in dealing with pointers, is that you should initalize all pointers to NULL, and also EXPECT all pointers that you deal with to be NULL. (ie make loops like while (foo != NULL) {..} (and be sure that foo will at some point be NULL) Also if you have pointers to pointers, like: foo->bar->var, be sure that foo and bar are NOT NULL. before doing foo->bar->var=value; Also watch when passing constant arguments, for instance calling: foo(A,B,0,D) for int foo(A,B,C,D) double A,B,C,D; { } is wrong, it should be foo(A,B,0.0,D) ^ | This a a FP argument while 0 is interpreted as an integer argument, so the values for C & D will be mangled (I've been bitten on this one with Lattice a few times). Another thing, if you have an array like: char foo[MAXLEN]; When you do loops include, i=0; while( i