From: "Damian Yerrick" Newsgroups: comp.os.msdos.djgpp Subject: Re: Pointers vs subscripting. Date: Wed, 29 Sep 1999 20:33:52 -0500 Organization: Rose-Hulman Institute of Technology Lines: 56 Message-ID: <7suepg$bip$1@solomon.cs.rose-hulman.edu> References: NNTP-Posting-Host: 137.112.205.146 X-Trace: solomon.cs.rose-hulman.edu 938655344 11865 137.112.205.146 (30 Sep 1999 01:35:44 GMT) X-Complaints-To: news AT cs DOT rose-hulman DOT edu NNTP-Posting-Date: 30 Sep 1999 01:35:44 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Kevin wrote: If you're trying to mung your address so that spambots don't get it, changing the domain to nospam.* doesn't work; your mail will probably still get through. Try changing demon to all caps and inserting a cute word (exorcist or something?) between two of the letters. krugman AT DEexorcistMON DOT co DOT uk This will confuse spambots more thoroughly. > Ive always gone to great lengths to avoid subscripting > arrays and have gone to lots of trouble to use pointers (at > least in the most frequently accessed loops, I don't usually > bother with program initialisation things). > > I have understood that this is the quicker way of doing things. Was. > Is this still the case or do modern compilers optimise this > automagically now ? Compilers use a technique known as "strength reduction" to turn multiplies into adds and adds into increments. If you are accessing a multidimensional array, try storing a pointer to the first element. int foo[6][6]; int *fooLine; for(y = 0; y < 6; y++) { fooLine = foo[y]; for(x = 0; x < 6; x++) { DoSomethingWith(fooLine[x]); } } Play with it for a while. Remember to compile with at least -O3 for best results. > I realise that a little experimentation would probably answer this > question for me, but I'm posting another message here at the same If you are wondering about the speed of one technique versus another, you always have gprof. Read the FAQ at http://www.delorie.com/djgpp/v2faq/ Damian Yerrick http://come.to/yerrick