comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: New to ada, a few questions
Date: Mon, 5 Aug 2002 21:31:57 -0500
Date: 2002-08-05T21:31:57-05:00	[thread overview]
Message-ID: <mailman.1028601302.18195.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: yec8z3koo63.fsf@king.cts.com


----- Original Message -----
From: "Keith Thompson" <kst@cts.com>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: August 05, 2002 6:56 PM
Subject: Re: New to ada, a few questions


> Stephane Jolicoeur <s.jol@jol-tech.net> writes:
> > *** post for FREE via your newsreader at post.newsfeed.com ***
> >
> > Hello,
> > I am a strong python programmer that is looking for a compiled language to
> > complement my tool chest. I tried C but those pointers are an annoyance, I
> > tried C++ but there to the pointers and it's OO weirdness kicked in. Then
I
> > stumbled on an Ada tutorial, I dislike the Pascal-like coding style but
> > there seems to be no pointer and it can be compiled to native byte code !
> >  I would like to know, what good books are there for learning ada ( some
> > sort of tutorial/reference book). How "fast" is compiled Ada code by this
I
> > mean is it like C/C++ or more like Java? I read that it is possible to
> > interface Ada with C? How is this done? Can I use say stdio.h in an Ada
> > program? How about interfacing with C++ or objective C? Are there any GUI
> > librairies (windows, BSD, Mac OS X)? Has any Ada compiler been made to
> > compile code for microcontrollers ( PIC, 68hc11, etc )? How does the
> > threading work? I think this should suffice for a first post.
>
> Ada does have pointers; it calls them access types.  They're not
> needed nearly as often as they are in C.  For example, if you want to
> pass a parameter by reference, you just pass it; there's no need to
> use a pointer type.  Array types are array types.  The bounds of an
> array are fixed when the object is created, but they can be determined
> at run time; again, there's no need to use pointers.  Even when you do
> use pointers, it's much easier to do so safely.  Pointer arithmetic, a
> major source of undefined behavior in C, is not built into the
> language,

If pointer arithic is not built into the language, how do you explain
paragraph B.3.2 (1) which says:

1 The generic package Interfaces.C.Pointers allows the Ada programmer to
perform C-style operations on pointers. It includes an access type Pointer,
Value functions that dereference a Pointer and deliver the designated
array, several pointer arithmetic operations, and �copy� procedures that
copy the contents of a source pointer into the array designated by a
destination pointer. As in C, it treats an object Ptr of type Pointer as a
pointer to the first element of an array, so that for example, adding 1 to
Ptr yields a pointer to the second element of the array.

> and is almost never necessary. <metaphor>Of course you can
> shoot yourself in the foot, but it's harder to do so; the safety is on
> by default and you have to say "I want to turn off the safety now, and
> I know it's dangerous." before you disable it.</metaphor>
>
> No, you can't use <stdio.h> directly (Ada doesn't grok C syntax), but
> Ada does have good facilities for interfacing to other languages, with
> predefined support for C, Fortran, and Cobol, and compiler-specific
> support for C++.  Of course, Ada has its own I/O packages, so there's
> seldom any need to interface to the facilities defined in <stdio.h>.
>
> --
> Keith Thompson (The_Other_Keith) kst@cts.com  <http://www.ghoti.net/~kst>
> San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
> Schroedinger does Shakespeare: "To be *and* not to be"
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
>
>





      reply	other threads:[~2002-08-06  2:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-05 18:07 New to ada, a few questions Stephane Jolicoeur
2002-08-05 20:38 ` Jim Rogers
2002-08-05 22:27   ` akhar
2002-08-05 22:33     ` chris.danx
2002-08-05 23:25     ` Larry Kilgallen
2002-08-06  3:37     ` Adrian Hoe
2002-08-05 23:56 ` Keith Thompson
2002-08-06  2:31   ` David C. Hoos, Sr. [this message]
replies disabled

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