From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a1a88c4d509f6381 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: scope and/or parameters (beginner) Date: 1999/04/15 Message-ID: <7f51kt$m3u$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 466739299 References: <37064309.889106243@news.dsuper.net> <37084459.8616007@rocketmail.com> <370b0c99.1137352783@news.dsuper.net> <7ei04q$o$1@nnrp1.dejanews.com> <7et4vr$sdj$1@nnrp1.dejanews.com> <7euskv$d91$1@nnrp1.dejanews.com> <7evbei$opm$1@nnrp1.dejanews.com> <7f1jce$nt4$1@nnrp1.dejanews.com> <7f23j5$4mu$1@nnrp1.dejanews.com> <7f46ij$vfo$1@nnrp1.dejanews.com> X-Http-Proxy: 1.0 x9.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Thu Apr 15 15:46:40 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-04-15T00:00:00+00:00 List-Id: In article <7f46ij$vfo$1@nnrp1.dejanews.com>, czgrr wrote: > Ever since then, when I have the same sort of situation > with very large arrays, > etc, I always make them global. It is less logically > correct, yes, it may not be necessary *in that > environment*, yes, but it had fixed a bug and I learned > from it. You learned that a kludge that you did not understand fixed a particular problem in a particular environment for reasons that were unclear. Still if you have to kludge to get something working, sometimes you have to (though I would have investigated why this had the effect that it did, you might have found for instance, that this particular change by complete accident removed an Icache conflict in a completely unrelated part of the program). In the GNAT project, if we have to put in kludges of this kind, we mark them with ??? which is a reminder to fix them properly some time when we can figure out the proper fix, or better understand the situation. What you did wrong was to extend this observation in a way completely unjustified by the observation, and then put a nasty kludge in other programs, one which most certainly may damage the structure (e.g. making things task unsafe when they would otherwise be safe), and indeed likely slowing down things. When you make a change to your program that speeds things up, you should not conclude ANYTHING unless you understand WHY it sped things up. Remember that this thread started with your completely unjustified (and as it turns out unjustifiable) general statement that global arrays were more efficient than local arrays. An equally valid statement would have been to note that moving a declaration from line 345 to line 123 of the unit fixed the efficiency problem, and then deciding that in all units from now on, you will avoid the horribly innefficient results of putting any declarations in line 345 of any unit. Now, that's absurd, and you know enough to know it's absurd, so you avoid this mistake. Well the conclusion you drew is also absurd, you just don't know enough to *know* that it is! I will repeat, in my experience, the rumours and supposed knowledge that many programmers have about what is and what is not efficient are often vague, confused, or plain wrong, and frequently result in contaminated less maintainable code, and in many cases actually slow down processing (as would the practice of making arrays global on most machines). -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own