comp.lang.ada
 help / color / mirror / Atom feed
From: "DuckE" <nospam_steved@pacifier.com>
Subject: Re: bitwise comparators
Date: 2000/01/18
Date: 2000-01-18T00:00:00+00:00	[thread overview]
Message-ID: <38852412.0@news.pacifier.com> (raw)
In-Reply-To: 3882FC1C.2BA8C959@hotmail.com


Alexander Van Hecke <alexke@hotmail.com> wrote in message
news:3882FC1C.2BA8C959@hotmail.com...
> > I'd also like to point out that the "while" construct you are using is
> > common for 'C' or Pascal, but in Ada you could use a "loop" construct
with
> > "exit when"
> >
>
> thank you all for your response!
> As many of you have pointed out, I could have used exit when ...
> But as you probably noticed, I have a C background and I'm not that
familiar
> with Ada.  I think it's a nice feature of Ada that you can write
'readable'
> code, but IMHO Ada takes a lot longer to learn, there are more constructs,
> keywords, etc...  In a word, the language is more complicated, yet not
> necessarily more powerfull (hope I don't get flamed for this :-)).   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!
> What's your opinion on this?
>
> alex
>

I've done projects in both C and Ada, and when given a choice on a new
project I choose Ada.  Yes it takes a while to learn all of the nuances of
Ada, but the same is true of C.

There are numerous bugs I have run across in C programs that have been a
bear to track down, that are very visible in Ada.

Here's a few examples:

  for( i = 0 ; i < 10 ; i++ );
  {
    printf( "Value of i is %d\n", i );
  }

Gives the output:

  Value of i is 0

To "spot the bug" here's the equivalent Ada code:

for i in 0 .. 9 loop end loop
begin
  ada.text_io.put( "Value of i is " );
  ada.integer_text_io.put( i );
  ada.text_io.new_line;
end;

An experienced C programmer might see that extra semicolon instantly when
looking at the source code, but when digging for a needle in a haystack in a
large body of existing code, I personally can do without this kind of trap.

There are several other examples of simple C coding errors that can trip you
up, but you probably get my point.

SteveD






  parent reply	other threads:[~2000-01-18  0:00 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-15  0:00 bitwise comparators Alexander Van Hecke
2000-01-15  0:00 ` David C. Hoos, Sr.
2000-01-16  0:00 ` Matthew Heaney
2000-01-16  0:00 ` DuckE
2000-01-17  0:00   ` Alexander Van Hecke
2000-01-17  0:00     ` Jeff Carter
2000-01-17  0:00       ` Alexander Van Hecke
2000-01-17  0:00         ` Gautier
2000-01-17  0:00           ` Alexander Van Hecke
2000-01-17  0:00             ` David Starner
2000-01-18  0:00             ` Gautier
2000-01-18  0:00           ` Ted Dennison
2000-01-17  0:00         ` David Starner
2000-01-17  0:00           ` Alexander Van Hecke
2000-01-17  0:00             ` David Starner
2000-01-18  0:00             ` Fraser
2000-01-18  0:00               ` Bertrand Augereau
2000-01-19  0:00                 ` Ted Dennison
2000-01-19  0:00                   ` Marin D. Condic
2000-01-19  0:00                     ` Ted Dennison
2000-01-18  0:00             ` Preben Randhol
2000-01-18  0:00           ` Ted Dennison
2000-01-18  0:00         ` Pascal Obry
2000-01-18  0:00         ` Jeff Carter
2000-01-18  0:00           ` Keith Thompson
2000-01-19  0:00             ` Gisle S�lensminde
2000-01-19  0:00             ` Jeff Carter
2000-01-19  0:00               ` Keith Thompson
2000-01-19  0:00               ` David Starner
2000-01-19  0:00             ` Ole-Hjalmar Kristensen
2000-01-21  0:00         ` Ada vs. C/C++ (was re: bitwise something-or-other) Mark Lundquist
2000-01-21  0:00           ` Mark Lundquist
2000-01-24  0:00           ` Hyman Rosen
2000-01-17  0:00     ` bitwise comparators David C. Hoos, Sr.
2000-01-17  0:00     ` Matthew Heaney
2000-01-17  0:00     ` Gautier
2000-01-18  0:00       ` Keith Thompson
2000-01-19  0:00         ` Ole-Hjalmar Kristensen
2000-01-17  0:00     ` Mike Silva
2000-01-17  0:00       ` Alexander Van Hecke
2000-01-17  0:00         ` Gautier
2000-01-17  0:00         ` David Starner
2000-01-17  0:00         ` Mike Silva
2000-01-18  0:00           ` Charles Hixson
2000-01-17  0:00       ` Brian Rogoff
2000-02-05  0:00         ` Ashley Deas Eachus
2000-02-05  0:00           ` Jeff Carter
2000-02-06  0:00           ` Andy
2000-02-07  0:00           ` Brian Rogoff
2000-02-09  0:00             ` Robert Iredell Eachus
2000-01-17  0:00     ` tmoran
2000-01-18  0:00     ` DuckE [this message]
2000-01-18  0:00     ` Ted Dennison
2000-01-16  0:00 ` Jeff Carter
2000-01-16  0:00 ` Bryce Bardin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox