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, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b50bc6538a649497 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: if statements Date: 2000/11/09 Message-ID: <8ufd4n$obj$1@nnrp1.deja.com>#1/1 X-Deja-AN: 691816252 References: <3A02CED4.520C2768@brighton.ac.uk> <3A078B6F.D34B024B@erols.com> <8ua3m1$bru$1@nnrp1.deja.com> <3A09A39F.2822C01B@cepsz.unizar.es> <8udce8$1qi$1@nnrp1.deja.com> X-Http-Proxy: 1.0 x59.deja.com:80 (Squid/1.1.22) for client 205.232.38.240 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Thu Nov 09 23:48:41 2000 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.61 [en] (OS/2; I) Date: 2000-11-09T00:00:00+00:00 List-Id: In article , "Ken Garlington" wrote: > "Robert Dewar" wrote in message > news:8udce8$1qi$1@nnrp1.deja.com... > > : I would write the above as: > : > : procedure Conditional_Swap (A, B : in out Integer) is > : begin > : if A < B then > : declare > : Temp : constant Integer := A; > : begin > : A := B; > : B := Temp; > : end; > : end if; > : end Conditional_Swap; > > This causes the *smaller* value to end up in A and the *larger* value to end > up in B? Now I REALLY feel like a beginning student! Well this anomoly had already been pointed out, so there was no point in repeating it, note that the above is advertised as a rewriting of "the above code", and I did not want to fix this problem since it would have confused the style points I was making. > Actually, I would also nitpick the choice of "Temp," when > better options are available (Initial_A, or the really > expressive Initial_Value_of_A). I disagree, this is long-nameitis carried to absurd extremes. Rewritten the way I had it the life time of Temp is three lines and it is obvious that it is initialized with the value of A. It merely obfuscates code to use long names where they do not help the reader. I actually think a more appropriate choice of name would have been T :-) Sent via Deja.com http://www.deja.com/ Before you buy.