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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6bee08c26af9486d X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!b1g2000hsg.googlegroups.com!not-for-mail From: mockturtle Newsgroups: comp.lang.ada Subject: Re: Learning Ada but missing the basics? Date: Mon, 30 Jun 2008 14:18:04 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <85e95c57-07c3-42eb-b9b9-eac5fd3d0d65@i76g2000hsf.googlegroups.com> NNTP-Posting-Host: 62.101.126.216 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1214860685 10989 127.0.0.1 (30 Jun 2008 21:18:05 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 30 Jun 2008 21:18:05 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b1g2000hsg.googlegroups.com; posting-host=62.101.126.216; posting-account=9fwclgkAAAD6oQ5usUYhee1l39geVY99 User-Agent: G2/1.0 X-HTTP-UserAgent: Opera/9.27 (X11; Linux i686; U; en),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:967 Date: 2008-06-30T14:18:04-07:00 List-Id: On Jun 30, 10:38=A0pm, ryan k wrote: > On Jun 30, 4:19=A0pm, Keith Thompson wrote: > > > > > ryan k writes: > > > I'm trying to learn Ada because a) I think it's cool to learn new > > > computer languages and b) it looks like a good one. I've gone the > > > through a lot of the tutorials but lets say have package MyPackage and= > > > 5 subprograms are in the body. Which procedure is run first? Is it > > > sequential? > > > None of them will run unless they're called. > > > > =A0 =A0 =A0 =A0 =A0 =A0 Is there some sort of equivalent to C's main()= ? > > > Not exactly. =A0There's no special name for the entry point. =A0You > > specify it when you link the program. > > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Is a > > > binary created for every package? > > > That depends on what you mean by "a binary". =A0There typically won't be= > > an executable created for each package. =A0An Ada package is similar in > > some ways to a separately compiled C source file; you can combine > > several of them, along with a procedure that's specified to be the > > main program, into a single program. =A0The details of how you do this > > are defined by each implementation, not by the language. > > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 I = guess I don't understand where > > > things start and end. Any help or links are greatly appreciated! > > > -- > > Keith Thompson (The_Other_Keith) ks...@mib.org =A0 > > Nokia > > "We must do something. =A0This is something. =A0Therefore, we must do th= is." > > =A0 =A0 -- Antony Jay and Jonathan Lynn, "Yes Minister" > > I use the GNAT compiler. How then do I specify the main procedure? > > Thanks. I remember I had the same problem when I began... ;-) Just write a file some_name.adb with a procedure some_name in it. When you use gnatmake some_name GNAT will take care of all the dependencies and will create an executable file "some_name". When you run it, the procedure some_name will be executed. (BTW, is not this great? No *#$% Makefiles...) For example, here it is the typical "Hello World" -- BEGIN File hello_world.adb with Text_Io; procedure Hello_World is begin Text_Io.Put_Line("Hello World!"); end Hello_World; -- END File hello_world.adb Disclaimer: I wrote the code above "on the fly" and I did not check if it compiles, although it should...