comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.not.jrcarter@acm.not.spam.org>
Subject: Re: basic basic ada question
Date: Fri, 20 Oct 2006 05:10:05 GMT
Date: 2006-10-20T05:10:05+00:00	[thread overview]
Message-ID: <NSYZg.201916$FQ1.62488@attbi_s71> (raw)
In-Reply-To: <wcczmbsymkp.fsf@shell01.TheWorld.com>

Robert A Duff wrote:
> 
> Why should one think in C or Ada?  There are lots of concepts that
> transcend the languages.  After all, both languages have subroutines,
> parameter passing, stack/heap allocation, etc, etc.

The Ada mindset is essentially the same as the SW engineering mindset.

> Well, actually, the first argument is numbered 1 in C, too.  ;-)
> argv[0] is what Ada calls Command_Name -- not one of the arguments.

To C, it's one of the arguments (the 1st, so naturally it's numbered 0). 
Ada realizes that it's not. It's the command that the arguments are 
arguments to.

> Dijkstra wrote an interesting paper called "Why numbering should start
> at zero", which you can find via google.  I don't buy it -- I like to
> number most things starting at 1, despite his fairly reasonable
> arguments to the contrary.

I've seen it, and I don't buy it, either. My experience is that fewer 
mistakes are made when the numbering from the domain is used. Some of 
his arguments, such as ease of calculating the length of a sequence, are 
things that the language should do for you. There should be 'Length for 
discrete subtypes; it returns the number of values in the subtype.

> It's interesting that for enumeration types, T'Pos starts numbering
> at 0.

Yes. They're not Pos-itions, they're offsets. Positions should start at 
1. If they did, then T'Base'First could be 0. That might be useful in 
some cases.

-- 
Jeff Carter
"I fart in your general direction."
Monty Python & the Holy Grail
05



  reply	other threads:[~2006-10-20  5:10 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-19 14:30 basic basic ada question markww
2006-10-19 14:47 ` Georg Bauhaus
2006-10-19 15:10   ` markww
2006-10-21 10:29     ` Stephen Leake
2006-10-19 15:11 ` Dmitry A. Kazakov
2006-10-19 15:45   ` markww
2006-10-19 16:29     ` Gautier
2006-10-19 17:16     ` Dmitry A. Kazakov
2006-10-19 20:07     ` Jeffrey R. Carter
2006-10-19 22:20       ` Robert A Duff
2006-10-20  5:10         ` Jeffrey R. Carter [this message]
2006-10-20  7:13           ` Maciej Sobczak
2006-10-20 20:39             ` Jeffrey R. Carter
2006-10-20  7:25       ` Maciej Sobczak
2006-10-20 20:54         ` Jeffrey R. Carter
2006-10-19 21:30 ` James Alan Farrell
2006-10-19 23:03   ` Robert A Duff
2006-10-20  4:54   ` Jeffrey R. Carter
2006-10-20  7:53   ` Dmitry A. Kazakov
2006-10-20  8:17     ` Maciej Sobczak
2006-10-20  9:08       ` Dmitry A. Kazakov
2006-10-20 11:15         ` Maciej Sobczak
2006-10-20 12:19           ` Dmitry A. Kazakov
2006-10-20 12:38             ` Maciej Sobczak
2006-10-20 13:26               ` Dmitry A. Kazakov
2006-10-20 15:29             ` Robert A Duff
2006-10-20 17:37               ` Dmitry A. Kazakov
2006-10-20 20:59                 ` Robert A Duff
2006-10-21 13:39                   ` Dmitry A. Kazakov
2006-10-21 17:53                     ` Robert A Duff
2006-10-22  8:45                       ` Dmitry A. Kazakov
2006-10-23  7:45                     ` Maciej Sobczak
2006-10-23  9:21                       ` Dmitry A. Kazakov
2006-10-23 14:30                         ` Maciej Sobczak
2006-10-23 15:08                           ` Dmitry A. Kazakov
2006-10-23 15:49                             ` Robert A Duff
2006-10-24  7:34                               ` Dmitry A. Kazakov
2006-10-20 19:04           ` Simon Wright
2006-10-20 15:27         ` Robert A Duff
2006-10-20 17:37           ` Dmitry A. Kazakov
2006-10-20 21:00     ` Jeffrey R. Carter
2006-10-21  8:19       ` Dmitry A. Kazakov
2006-10-21 17:32         ` Robert A Duff
2006-10-22  8:45           ` Dmitry A. Kazakov
2006-10-30 11:46             ` Martin Krischik
replies disabled

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