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,bd45e29f9dafca87 X-Google-Attributes: gid103376,public From: Ted Dennison Subject: Re: bitwise comparators Date: 2000/01/18 Message-ID: <8622cm$ap8$1@nnrp1.deja.com>#1/1 X-Deja-AN: 574231906 References: <3880D375.7E363123@hotmail.com> <38829638.0@news.pacifier.com> <3882FC1C.2BA8C959@hotmail.com> X-Http-Proxy: 1.0 x31.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Tue Jan 18 15:55:07 2000 GMT X-MyDeja-Info: XMYDJUIDtedennison Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.6 [en] (WinNT; I) Date: 2000-01-18T00:00:00+00:00 List-Id: In article <3882FC1C.2BA8C959@hotmail.com>, Alexander Van Hecke wrote: > In C you'd have one while loop, and you'd put your condition in the > while expression and that's it. Nothing more to learn about it! I'm a bit confused at this. Ada has a while loop construct too eg: while x < y loop end loop; This is one of the situations where the two languages are essentially similar. The main difference is that Ada doesn't require parens around the conditional. An improvement as far as ease of learning goes, I'd say. I could go on a while about C vs. Ada loops. I like C's do..while loops. Its kind of a shame Ada doesn't have that. But Ada essentially has an "anywhere-tested" loop with the construct: loop ... exit when x=y; ... end loop; You can of course simulate that in C with break, but that's really more like doing a "if ... exit; endif;" in Ada, so I don't consider it the same. And the for (;;) you use to make the infinite loop looks goofy. It really comes off looking like a hack, where in Ada its quite natural. C's continue statement would be helpful often in my Ada code, but it does make the code tougher to follow. The power of C's for statement is kind of neat. But I think this may be a situation where power corrupts. I'm always too tempted to put the entire contents of the loop in the for conditional (in the middle term, separated by commas). Proper use of Ada's "for" statement is without question easier for a beginner to pick up. While I'm on that subject, I think the question mark operator is another C feature I love a little too much which was wisely left out of Ada. -- T.E.D. http://www.telepath.com/~dennison/Ted/TED.html Sent via Deja.com http://www.deja.com/ Before you buy.