Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
self-taught programmer or schooled?
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
aja
l33t
l33t


Joined: 26 Aug 2002
Posts: 705
Location: Edmonton, Canada

PostPosted: Fri Jan 10, 2003 4:08 am    Post subject: Reply with quote

BigRedDot wrote:

"int main()" is perfectly valid.


I was just about to fire off a flame about how int main(void) and int main(int argc, char** argv) are the only defined sigs for the main function when I decided to check. According to 3.6.1 of the ISO standard, int main() is entirely acceptable. So I stand corrected - which is particularly annoying 'cause I was so sure I was right. Thanks. I still don't like empty parameter lists in functions, though - I prefer to explicity state the void. But it looks like its just a personal preference of mine, which is arguably further from the spec that yours.

I'll take the point about the namespace declaration, as well. You make a good point, even if I'm not entirely sure I agree.

I stand by requiring endl or flush at the end of the cout insertion, though...:-)
Back to top
View user's profile Send private message
kraylus
l33t
l33t


Joined: 07 Jun 2002
Posts: 648
Location: ft.worth.tx

PostPosted: Fri Jan 10, 2003 6:38 am    Post subject: Reply with quote

ok, that's what i was doing wrong. i was using cc -o instead of g++ -o.

quick question... what's "-Wno-deprecated" for?

i'll take another look at the book. damn pebcak errors ;) but im thinking i'll stick with C for now. i'm already up to learning arrays (dunno, how far is that?) and character variables.

i did notice however that there were three ways of doing the same exact thing (based on the original code i posted). EACH very different from the last. what's up with that? why all the extra typing?

ryan

p.s. why can't you put a space when getting data using scanf in C? is there a way to get around this? what if someone wants to type their state in and it's "new york"?
_________________
I used gentoo BEFORE it was cool.
Back to top
View user's profile Send private message
sarnold
Developer
Developer


Joined: 28 Nov 2002
Posts: 115
Location: California

PostPosted: Fri Jan 10, 2003 8:44 pm    Post subject: Back to the original topic... Reply with quote

On the subject of programming languages, school vs. self-learning, etc.

1) Being self-motivated is the key to both. Don't pooh-pooh community college or university courses; yes, many CS programs are still in the dark-ages, but there are also many, many sharp Software Engineering and CS professors out there (albeit some colleges only have one or two of them). There's also a *big* difference software engineering and traditional computer science, and most programmers/geeks are firmly rooted in the old-world CS (to the detriment of everyone).

For myself, I can self-teach certain things, but I really need a good classroom environment (with challeging homework, a good instructor, etc). That's what motivates me the most (at least in the beginning). And you can get a very good education in the basics, even at a community college. For example, one of my coworkers teaches CS at the same community college where I teach physical science (we're both part-time faculty). He's one of the sharpest software geeks I've ever met (he composes state-machines in his head, and then writes the code to implement it; and he can do it in at least 10 different languages). I've taken two classes from him (since my degrees are in geophysics) and they were worth every minute/penny. Search comp.lang.ada/c/c++ for posts by Jeff Cherry.

I also worked for a CS professor in grad school; he's the only modern software guy at SDSU (Prof. Roger Whitney) but it would be worth doing a CS degree there just to be around him...

http://www.eli.sdsu.edu/

2) Most programming languages suck, and this includes the popular ones: C, C++, java, etc. None of them were really designed, they just sort-of eveloved. Your brain may be permamently damaged if you start with any of those. I've spent the last 10+ years doing Independent Validation & Verification (IV&V) on other people's code. And I'm talking real-time, safety critical space launch software. You know what? Most of it sucks too... Much of it is still leagcy Fortran (and it's some of the worst code you've ever seen), and about the only code that runs worth a damn, is easy to decipher, and not a total maintenance pig, is written in Ada.

There are two languages written for humans (ie, they're designed to be readable) which are worth using and learning with: Python and Ada. You can do procedural programming, structured programming, or object-oriented programming with them. They have excellent exception handling and library support, are truly portable, etc. There are also excellent books available (some free). Try John English's Ada95 book:

http://www.it.bton.ac.uk/staff/je/adacraft/

John English also has en excellent web site (also available on CD) with CS resources (BURKS). Go here:

http://burks.brighton.ac.uk/

And check out the Python Beginner's guide:

http://www.python.org/doc/Newbies.html

There are several free books and tutorials on the above page (How to Think Like a Computer Scientist is particularly good).

Another Guru-dude with some excellent free books is Bruce Eckel. On his site, you'll find freely downloadable books on Python, C++, Java, and C#.

http://www.mindview.net/Books

Bruce is a true geeky-guru dude, and his books are top-notch. But you know what? He makes his living off the books. seminars, and training for C++ and Java, but when he writes software for himself (ie, he wants to get something done) he uses *Python*. According to Bruce himself, Python makes him about 10 times more productive than Java. 10 times!!! That ought to tell you something about the quality and usefulness of those other languages...

Several previous posts also touched on some important points, ie, don't get lost in the syntax/semantics of any particular language; try to focus on the concepts. This is one reason whay Python and Ada are such good teaching languages (and good for newbies to start with), and is especially true of Python.

Overall, any programming language is just a tool, and should be chosen based on the engineering requirements for a given project. However, this is not to say that all languages are more-or-less equivalent (they're not). Yes, for most software projects, you can achieve the desired effect with almost any language, but the end result will not be the same in terms of quality, performance, stability, maintenance costs, etc.

Irrespective of language choice, quality must be dedigned in from the start; it will *not* happen on its own (ie, by magic). However, the choice of language can make or break a project, and has a huge impact on the overall result, especially life-cycle costs.

Again, software engineering is the name of the game, not traditional computer science. If you're truly serious about pursuing a degree, then find a school that has a real software engineering program, ie, Carnegie Mellon, McMaster Univ., Brighton Univ, etc (most schools haven't made the leap yet; too many old farts that still need to retire, I guess...). But you can go far hanging out with open source geeks on mailing lists, comp.lang.*, IRC, etc.

Hope this helps (and doesn't start too many flame wars ;)
Back to top
View user's profile Send private message
dripton
n00b
n00b


Joined: 16 Aug 2002
Posts: 65
Location: Virginia USA

PostPosted: Fri Jan 10, 2003 9:36 pm    Post subject: Don't start with C Reply with quote

Learning to program for the first time using C is like learning to juggle for the first time using chainsaws.

You'll get bogged down in the memory management and pointer math and remembering to null-terminate your strings. To much focus on getting very basic stuff to work at all detracts from focusing on your algorithm. Maybe you'll get frustrated and decide that programming is not for you. Maybe you'll persevere, but in any case you'll learn a lot more slowly than if you'd started with a more appropriate language.

I strongly recommend Python as a first language. Basic things like strings and lists just work. No manual memory management or pointer math. Very readable code. Large higher-level API. No compile cycle. And there's an interactive prompt, so you can test things out in realtime. See http://www.python.org/doc/Newbies.html for a big list of free online tutorials.

If you decide to stick with programming then eventually C should definitely be part of your toolkit. But not yet. Beanbags, then clubs, *then* chainsaws.
Back to top
View user's profile Send private message
kraylus
l33t
l33t


Joined: 07 Jun 2002
Posts: 648
Location: ft.worth.tx

PostPosted: Fri Jan 10, 2003 10:38 pm    Post subject: Reply with quote

excellent!

very informative. you've piqued my interest in python for sure ;)

but can i make gui apps with python? you mentioned that i can do anything with any programming language.

to answer a few others, im not learning programming just to learn it. im learning it because it's a means to an end. i wanted to make an email client. originally a friend and i were going to tinker around with some scripts to try and get a script to telnet into our pop3 server and return a list of mail with the from line, to line and subject.

eventually, i wanted it to evolve into something similar to eudora. nice and fast. highly stable and really compact.

i have yet to find an email client for linux that meets those standards. so i figured that would be my pet project and i would choose a programming language to accomplish that. i was told C would be a good candidate so i went with that. a means to an end. it just so happens that C's been around for over 30 years, is well established, and is easy to get support for.

are you telling me that python is easier to learn, and can make nice stream-lined gui apps?
_________________
I used gentoo BEFORE it was cool.
Back to top
View user's profile Send private message
aja
l33t
l33t


Joined: 26 Aug 2002
Posts: 705
Location: Edmonton, Canada

PostPosted: Fri Jan 10, 2003 10:42 pm    Post subject: Reply with quote

kraylus wrote:

but can i make gui apps with python?


Yep. Python integrates with the tcl/tk toolkits, as well as other widget sets like GTK, Qt, etc. to allow gui apps.

See:

http://www.metaslash.com/brochure/tutorial/
Back to top
View user's profile Send private message
aja
l33t
l33t


Joined: 26 Aug 2002
Posts: 705
Location: Edmonton, Canada

PostPosted: Fri Jan 10, 2003 10:57 pm    Post subject: Reply with quote

Followers of this thread should also look at:

https://forums.gentoo.org/viewtopic.php?t=23279
Back to top
View user's profile Send private message
BigRedDot
n00b
n00b


Joined: 29 Oct 2002
Posts: 67
Location: Austin

PostPosted: Fri Jan 10, 2003 11:04 pm    Post subject: Reply with quote

Quote:
very informative. you've piqued my interest in python for sure icon_wink.gif


I'd been biting my tongue, since your decision seemed to have been made. But if not, I can't strongly enough second the Python suggestion. It has clean and perspicous syntax, it has a multitude of libraries available (for GUI design, numerical calculation, parsing, you name it -- python has been brought to many applications, both large and small), and a large helpful and friendly user base. More than anything, you get to play and run your little code learing experiments and get immediate feedback, without being encumbered by alot of details that really aren't useful to you right now.

Anyway, Python is certainly easier to learn than C. And given that ist has bindings available for QT, GTK, wxWindows, Tk, and some others I odn't think you woudl be at a loss for creating GUI apps.
_________________
Even if you are one-in-a-million, there are still 6000 people just like you.


Last edited by BigRedDot on Fri Jan 10, 2003 11:08 pm; edited 2 times in total
Back to top
View user's profile Send private message
aja
l33t
l33t


Joined: 26 Aug 2002
Posts: 705
Location: Edmonton, Canada

PostPosted: Fri Jan 10, 2003 11:05 pm    Post subject: Reply with quote

kraylus wrote:

to answer a few others, im not learning programming just to learn it. im learning it because it's a means to an end. i wanted to make an email client.


I seem to be spamming the list, but I keep thinking of things...

Kraylus, In the O'Reilly Book "Programming Python" , 2nd Ed. (Picture of a Python), Chapter 11 has a section called "The PyMailGui EMail Client", which (you guessed it) takes you through building a basic GUI email client in python... :-)

Might be a good starting point ....
Back to top
View user's profile Send private message
kraylus
l33t
l33t


Joined: 07 Jun 2002
Posts: 648
Location: ft.worth.tx

PostPosted: Fri Jan 10, 2003 11:08 pm    Post subject: Reply with quote

you guys are awesome! i'll take a look at that newbies page right now. im waiting for a customer to finish an install so i've got some time.

i can't help but feel like im doing the wrong thing by not learning C first though. i was always under the impression that python was slow and blah blah blah. i'm now a complete newbie to programming. i took comp sci in high school and learned pascal there. i've done html (yeah yeah, i know) on a regular basis since then. i've made small little bash scripts and i've some small experience with java. granted, i cant do much useful with all i've learned, but i'm not entirely new ;)

in conclusion, i'm not new, but i still don't know any programming languages (except HTML but im sure that doesn't count). should i still go with python?
_________________
I used gentoo BEFORE it was cool.
Back to top
View user's profile Send private message
kraylus
l33t
l33t


Joined: 07 Jun 2002
Posts: 648
Location: ft.worth.tx

PostPosted: Fri Jan 10, 2003 11:14 pm    Post subject: Reply with quote

BigRedDot wrote:
Quote:
very informative. you've piqued my interest in python for sure icon_wink.gif


I'd been biting my tongue, since your decision seemed to have been made. But if not, I can't strongly enough second the Python suggestion. It has clean and perspicous syntax, it has a multitude of libraries available (for GUI design, numerical calculation, parsing, you name it -- python has been brought to many applications, both large and small), and a large helpful and friendly user base. More than anything, you get to play and run your little code learing experiments and get immediate feedback, without being encumbered by alot of details that really aren't useful to you right now.

Anyway, Python is certainly easier to learn than C. And given that ist has bindings available for QT, GTK, wxWindows, Tk, and some others I odn't think you woudl be at a loss for creating GUI apps.


wow, three in a row say python... hrm... man... grr... bluh... damn. i'm torn. torn i tell you! seriously?! python? why didn't anyone mention this until now?
_________________
I used gentoo BEFORE it was cool.
Back to top
View user's profile Send private message
Valen
Apprentice
Apprentice


Joined: 18 Aug 2002
Posts: 197
Location: Toronto, Ontario, Canada

PostPosted: Sat Jan 11, 2003 9:14 am    Post subject: Reply with quote

Well, consider this, unless you decide to take a course you can always start with python and go back to c if you don't like it. Once you understand the main concepts behind programming learning another language (which supports the same programming style) is fairly simple. And pointers in c really suck. Also if you don't like python there are several other languages which are easy to pick up for beginners.
Back to top
View user's profile Send private message
hype
Tux's lil' helper
Tux's lil' helper


Joined: 23 Nov 2002
Posts: 84
Location: Finland

PostPosted: Sat Jan 11, 2003 9:52 am    Post subject: Reply with quote

I'm not a programmer yet, but I am learning perl and I find it quite ok to learn. I have a good memory and I can handle those weird default variables.
When I had to decide what I will start studying my two choices were perl and python. I chose perl because it has one of the best books available from O'REILLY and altough they say it's not the most easy to learn it is fast to program. The books I am using: Learning Perl, Programming perl and Mastering regular expressions all from O'REILLY.
Back to top
View user's profile Send private message
BigRedDot
n00b
n00b


Joined: 29 Oct 2002
Posts: 67
Location: Austin

PostPosted: Sat Jan 11, 2003 4:16 pm    Post subject: Reply with quote

For the love of god, please don't start with perl. Apart from being a non-orthogonal mish-mish of cobbled-together unix command line tools, liberally peppered with eye-straining special symbols, any language that defaults to dynamic scoping is just broken.

I'd even recommend starting with C before perl and that is quite an indictment.

BTW I never answered the original question. I did go get a CS degree, and being of an academic bent, I found the mathematical background both useful and interesting. However, as for hands on programming, I will confess school only provided a basic foundation. learned more coding hygiene and good practices at a job, at a research lab writing software for submarines. I don't actually program professionally anymore though, I am about to start a PhD in physics.
_________________
Even if you are one-in-a-million, there are still 6000 people just like you.
Back to top
View user's profile Send private message
really
Guru
Guru


Joined: 27 Aug 2002
Posts: 430
Location: nowhere

PostPosted: Sun Jan 12, 2003 1:03 am    Post subject: Reply with quote

ada n00b quiz:

i tryed compiling an ada source file, but gcc tells me "Ada compiler not installed on this system" so i searched for an ebuild, but cant seem to find any.
is ther a ebuild for gnat(ada)?
_________________
NoManNoProblem

Get lost before you get shot.
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Mon Jan 13, 2003 6:26 am    Post subject: Reply with quote

Zadeh wrote:
one such of many excellent examples of the entrenched bias against C++ from (I would guess) a C programmer which (as a previous poster mentioned) drives people mad.
I knew C before I knew C++ because at the time I learned C, C++ did not exist. I switched from C to C++ and did all my work in C++ for about 5 years. I still use C++ from time to time. True, at the time I was heaviest in my C++ phase (1991 - 1995), template support in the language (and in compilers) was fairly rudimentary. Stroustrup himself called the original language before the cfront preprocessor "C with Classes", so I stand by my assertion that the people that will find C++ most intuitive are those with a C background that wish to have more support in the language itself for classes and, as you rightly point out, templates.
Quote:
There is no requirement in C++ that it be used in an "object-oriented" way.
True, but I never said that there was any such requirement. Please let me make clear that I am not trying to blast C++ as a language: I just think that one of its strong points for certain classes of people is its C compatibility, and people with no C experience get no benefit from this.
Quote:
most of the attention in the language over the last several years has been paid to functional-like semantics with templates.
Templates can be a great, concise and elegant way to write certain classes of code, specifically general-purpose algorithms and libraries. I personally find them very hard to get right at an initial design pass, and I have also found them to have their fair share of subtle bugs that are difficult to diagnose. I think that if they were among the first concepts that I encountered when starting programming, I would have been overwhelmed, and so I don't think this is a good argument for C++ as a starter language.

Quote:
Quote:

One of C++'s design decisions was to maintain as high a degree of C compatibility as possible. This has led to all sorts of bizarre baggage that barely makes sense for people who know C, and for those without a C background it will seem completely through the looking-glass.


Having taught C++ last semester to students first-hand I find that statement a gross and disengenuous exaggeration.
Well, having never taught C++ in my life, you have me at a bit of a disadvantage here. To give some concrete examples of the sort of baggage I was talking about, how do you explain to students why "static" is used to mean both "visible only in this compilation unit" and "denoting class methods or data as opposed to object methods or data", why the same keyword was chosen for both meanings, and how one can easily tell in which context the word is being used? How do you explain the difference between a string and a char *? How do you explain the different ways that "virtual" is used, when applied to base classes and member functions? When and why do you need to declare destructors virtual? Why do you need to beware of "a = a" when writing operator= and what to do about it? When does one use malloc/free and when new/delete? Why is there an array operator new? What is the difference between pointers to functions, pointers to member functions and pointers to class functions?

All of this stuff makes much more sense if you understand the C meanings of things, and you can recognize these C influences. Without a background in C, I would expect these subjects to be much harder to grasp. It was also helpful to me learning C++ to understand how cfront worked: that there was a magical pointer-to-object argument added to all member function calls. How name mangling worked, which explained why return types of functions are not usable for disambiguating overloaded functions. Understanding implicit int types and being familiar with the evolution of function prototypes in C makes some of the ambiguities in the C++ declaration grammar easier to stomach. Thinking of classes as an extension of POD structs makes more sense when one is familiar with C structs.

I understand, appreciate, and revel in the fact that we can all have different opinions and preferences, and hopefully still be able to interoperate and respect one another. I hope that I have not been overly harsh in my comments.
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
iso
n00b
n00b


Joined: 06 Dec 2002
Posts: 6
Location: Sweden

PostPosted: Mon Jan 13, 2003 2:13 pm    Post subject: Re: self-taught programmer or schooled? Reply with quote

kraylus wrote:
im 21 and im trying to teach myself how to program C out of 3 different books. one is mentioned in a previous thread which is aimed at dos users (it's an old book). im starting with that because it's very dumbed down and it's exactly what i need. the other book is a linux programming for beginners book. it assumes you already know basic C though it claims that it's not necessary. i intend to get into that once i actually do know basic C ;)

i find it very slow going primarily because i have very little free time in which i can do this... i was just wondering if i should consider taking classes on the weekends at some local community college.


If you are serious about programming I suggest that you maintain two parallel paths in your learning.

  • Learn a programming language.
  • Learn the basics in computer science.

C is a little complicated language compared to others, but if you have a good book to follow it can be a good language to start with. I had “The C programming language” by Kernighan & Ritchie in my introductory course for the practical programming. Along with that we had “Structure and interpretation of computer programs” by Abelsson & Sussman for the more general concepts in programming. In the latter book LISP is used as programming language. I highly recommend both books for an introduction to programming. Although I do not use LISP regularly (other to get emacs running properly), it is really a good learning platform for general concepts in computer science, since it has a syntax that is very easy to pick up.

When you are new to programming it is tempting to create big programs right away. What you have to remember is that learning programming is not what you make, but how you make it. I can almost guarantee you that you will be a better programmer in a shorter time if you stick with learning basic programming with basic techniques before creating programs with GUI and other fancy stuff. “The C programming language” does that. It is also a complete book it the sense it explains everything (and some things are really complicated).

If you have the time you will probably do better if you take classes at the Unviersity, since a lot of the learning is done when you actually explains your thoughts for someone. They will probably make you learn some important (but boring) stuff you otherwise would have missed. :wink:

Good luck
Back to top
View user's profile Send private message
really
Guru
Guru


Joined: 27 Aug 2002
Posts: 430
Location: nowhere

PostPosted: Mon Jan 13, 2003 3:13 pm    Post subject: Reply with quote

can you reccomend something to start coding on, i understand (or "think" i do, ive made small, small programs testing everything i wonderd so i know what happes, ive also read many many diffrenet tuts on cpu inner workings and registers, to undersand pointers and such, and also read the art of assembly, not read all, but the relevand parts)

declarations, initialization, form or program, types, strings, arrays, functions and all that.
now i just cant figure out something to make by this knowlede. i dont feel fully fledge to jump on a large pice of code.
can you give me some "problem" to solve?
not have to do with file acces, sence i havent got that far. and memory allcolation.
thanks
_________________
NoManNoProblem

Get lost before you get shot.
Back to top
View user's profile Send private message
ZagiFlyer
Tux's lil' helper
Tux's lil' helper


Joined: 19 Apr 2002
Posts: 93
Location: San Jose, CA

PostPosted: Mon Jan 13, 2003 3:50 pm    Post subject: Both Reply with quote

I've been programming in industry since 1980, and I write in seven languages. I would have to say that learning your first language in the classroom is the best way to go. In my case, I learned Cobol in a high school class.

This tought me the basics of programming. Not just how to type in code, but also how to design a program, the importance of walk-throughs with others, and that actually *writing* the program is only the last 20% of the programming effort.

Once you've got your first language under your belt, then you can effecively teach yourself other languages. It sounds looney, but I think Cobol was an excellent first language because it enforces program structure and discourages spagetti code by its very nature.

In today's world, I would recommend C as a first language only if you take it in a classroom. C lends itself to well to poor programming habits if you don't have the knowledge or discipline to avoid them. Also, there are data and file structure concepts that are best tought in a classroom.

Obviously, others disagree, but this approach worked for me.
_________________
"Beer is proof that God loves us and wants us to be happy"

--Ben Franklin
Back to top
View user's profile Send private message
idl
Retired Dev
Retired Dev


Joined: 24 Dec 2002
Posts: 1728
Location: Nottingham, UK

PostPosted: Mon Jan 13, 2003 3:56 pm    Post subject: Reply with quote

Perl was my first language, I found it very easy to use and read - I still like its syntax.
Back to top
View user's profile Send private message
sarnold
Developer
Developer


Joined: 28 Nov 2002
Posts: 115
Location: California

PostPosted: Mon Jan 13, 2003 8:34 pm    Post subject: Reply with quote

antonik wrote:
ada n00b quiz:

i tryed compiling an ada source file, but gcc tells me "Ada compiler not installed on this system" so i searched for an ebuild, but cant seem to find any.
is ther a ebuild for gnat(ada)?


gcc 3.2 has Ada support built-in (as well as C, C++, Obj-C, F77, and java). Did you try compiling the Ada package with gnatmake? I.e., instead of using:

Code:
gcc foo.adb


try this instead:

Code:
gnatmake foo.adb


This works for me on both Gentoo and RedHat 8.0...

Steve
Back to top
View user's profile Send private message
really
Guru
Guru


Joined: 27 Aug 2002
Posts: 430
Location: nowhere

PostPosted: Mon Jan 13, 2003 8:54 pm    Post subject: Reply with quote

sarnold wrote:
antonik wrote:
ada n00b quiz:

i tryed compiling an ada source file, but gcc tells me "Ada compiler not installed on this system" so i searched for an ebuild, but cant seem to find any.
is ther a ebuild for gnat(ada)?


gcc 3.2 has Ada support built-in (as well as C, C++, Obj-C, F77, and java). Did you try compiling the Ada package with gnatmake? I.e., instead of using:

Code:
gcc foo.adb


try this instead:

Code:
gnatmake foo.adb


This works for me on both Gentoo and RedHat 8.0...

Steve
nope, gnatmake does not exist on my system, cant find it, also gcc foo.adb gives me the "Ada compiler not installed on this system"
and then stops.
i have gcc-3.2.1
my source according to the ada book, cant find link now, tells that an ada source file should be called .ads tryed renaming and trying, without expectation, and it tells the same thing, in the man page of gcc, it tells that to compile ada source the -s should be used as in gcc -s foo.ads
same error ada compiler not installed on this system, i guess it cant run gnat coz it isnt there.
maybe i forgot to incude ada in my USE flag?
is there such a thing as an "ada" flag?
ill check later, coz right now im writing an essay and dont have the time.
thanks anyway
_________________
NoManNoProblem

Get lost before you get shot.
Back to top
View user's profile Send private message
sarnold
Developer
Developer


Joined: 28 Nov 2002
Posts: 115
Location: California

PostPosted: Mon Jan 13, 2003 9:06 pm    Post subject: Re: Both Reply with quote

ZagiFlyer wrote:
I've been programming in industry since 1980, and I write in seven languages. I would have to say that learning your first language in the classroom is the best way to go. In my case, I learned Cobol in a high school class.
[snip]
Once you've got your first language under your belt, then you can effecively teach yourself other languages. It sounds looney, but I think Cobol was an excellent first language because it enforces program structure and discourages spagetti code by its very nature.
[snip]


In terms of that type of enforcement/encouragement, Ada probably does that better than any other language I know of. Of course, it helps if you don't fight the language definition or the compiler. Personally, I'd much rather have errors caught at compile-time than run-time...

Also, Ada's generic packages are what the STL should have been (and in this case, OO is optional). Generic packages, generic formal parameters, etc, are about the cleanest and most useful implementation of re-usable components I've seen.

I relalize everyone has their own preferences, likes, and dislikes, but what I'm talking about has mostly to do with technical merit, software quality, life-cycle costs, etc. If anyone else has over 10 years of IV&V experience on safety-critical real-time code, please raise your hand...

Based on the above, there are really only two languages that are worth a damn IMNSHO (for over 99% of the code out there, anyway) - Ada and Python. Both were designed to make things easier for people to write, read, maintain, etc. Both handle many things for you (in other words, they make your life easier and more productive). and provide a wealth of useful library routines (and unlike the Java and C++ libs, you can actually understand, remember, and use them).

Although Ada and Python have similar clean and elegant syntax (as well as other similarities) they really have different domains:

Python: interpreted, weakly typed, rapid code/execute/test, good for prototyping, building glue interfaces, guis, etc.

Ada: compiled (with better runtime performance than C, mostly), strongly typed, language-defined safety, embeded, and other features, good for safety-critical, mission-critical, long-lived, high-quality applications.

If it were up to me, I wouldn't use anything else (other people can do the assembly suff ;)
Back to top
View user's profile Send private message
sarnold
Developer
Developer


Joined: 28 Nov 2002
Posts: 115
Location: California

PostPosted: Mon Jan 13, 2003 9:20 pm    Post subject: Reply with quote

antonik wrote:
nope, gnatmake does not exist on my system, cant find it, also gcc foo.adb gives me the "Ada compiler not installed on this system"
and then stops.
i have gcc-3.2.1
my source according to the ada book, cant find link now, tells that an ada source file should be called .ads tryed renaming and trying, without expectation, and it tells the same thing, in the man page of gcc, it tells that to compile ada source the -s should be used as in gcc -s foo.ads
same error ada compiler not installed on this system, i guess it cant run gnat coz it isnt there.
maybe i forgot to incude ada in my USE flag?
is there such a thing as an "ada" flag?
ill check later, coz right now im writing an essay and dont have the time.
thanks anyway


In Ada, a .ads file is a package specification, and a .adb file is a package body. Sort of like .h and .c files, but newer, better, etc. You aren't *required* to have both a body and a spec; writing a package body with a few functions/procedures is perfectly fine. However, you want to compile the body file, just as in "gcc foo.c".

Doh! I guess I should have tried Gentoo first (before opening my big mouth) but I got the same error as you did. I assumed since the gcc versions were so close, but no. Here it is on redhat 8:

Code:
[sarnold@copernicus sarnold]$ gnatmake stub.adb
gcc -c stub.adb
stub.adb:1:01: compilation unit expected
gnatmake: "stub.adb" compilation error


Of course, stub.adb is completely empty (I didn't have any Ada packages handy...)

And no, AFAIK, there is no "Ada" USE flag for gcc; I thought it was all bundled together now in gcc 3.2 and later. But I suppose there could very well be a gcc build option for that, and could have been left out of the ebuild.

Okay, Gentoo gcc gurus: what's the deal with the missing Ada support?
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Mon Jan 13, 2003 11:23 pm    Post subject: Reply with quote

The gcc ebuild (at least 3.2.1-r6) appears to attempt to enable ada support, so you might want to add a comment to bug #11204.
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum