Hi,
There is an excellent Borland-like IDE for beginners, and if you hunt around www.freshmeat.net you'll probably find it.
I had tested several IDEs on linux for programming C/C++.
It seems to me that a minimum requrement for an IDE wiil be the following three fearures :
1) support for gcc compilation
2) a reasonable debugger (watches, berakpoints)
3) code completion
A good candidate I encountered is kdevelop; http://www.kdevelop.org. (free,open source).
The problem with it is that sometime the code completion does not work. And if you are
aiming at medium/big projects it is really annoying. Really annoying!
The same Kdevelop ide supports aslo other programming languauges like Java but I didn't tested it.
There is borland C/C++ for linux (it's called cbuilderX ; it is non free); However, it did not had code completion when I tested it
about 2-3 months ago (maybe now they have). They do have a debugger with watches,breakpoints,and it looks like the usual boreland IDE.
What I am trying in the last months , and it seems that I will probably adopt, is the eclipse IDE.
This is a free , open source IDE , supported by IBM.
see: http://www.eclipse.org
When you download Eclipse you get an IDE for java;
In order that Eclipse will support C/C++ you should also download and install
C/C++ Development Tools from http://www.eclipse.org/cdt.
I had done so and up till now it is OK.
Take in mind that the eclipse ide is quite heavy because it is written in Java.
However, if you intend to work in the future in Java , knowing this IDE can be a little advantage
if you will choose it for java development.
The eclipse IDE also runs on windows (There are sometimes, unforunately,cases when people need it...)
Regards. Amir
From: Glen Turner <[EMAIL PROTECTED]> To: David Bowskill <[EMAIL PROTECTED]> CC: [email protected], [EMAIL PROTECTED] Subject: Re: [SLUG] GCC question Date: Wed, 20 Apr 2005 10:28:01 +0930
David Bowskill wrote:Your email has been very helpful to me - thanks again. When I initially copied the program from Herbert Schildes book
Well that explains why you're incrementing characters in strings. I was wondering (it's not really a good idea because of internationalisation).
Herbert Schildt's books aren't fantastic -- he has written a lot, he explains things poorly and they don't get updated that often. And the enforcement of strings literals being constant is only recently come into vogue. For a long time it wasn't seen as a good idea, but in this age of buffer overflows you want everything that can be a constant to be a unalterable.
The library function strdup() is not mentioned in K&R but strcpy() is - I assume that these are very similar.
It's in UNIX98, not ANSI/ISO C. Sorry about that. Off the top of my head
char *strdup(const char *str) { char *new;
new = (char *)malloc(strlen(str) + 1); if (new) { strcpy(new, str); } return new; }
[Once you've learnt C have a look at PJ Plauger's book on implementing the standard C library. There's no better way to learn to use a library than to be walked through an implementation by a wonderful author.]
There is another question which no doubt you can help on - I have read that the library function 'gets' (defined in K&R) is regarded as dangerous in Linux - is this true?
It's unsafe in any operating system. Take this example to read a string of up to 10 characters:
char s[10+1]; success = gets(s); if (!success) { ...
now what's going to happen when the user feeds it 20 characters? It's going to try to write outside the bounds of the allocated string.
You want to say this:
#define S_SIZE (10 + 1) char s[S_SIZE]; success = fgets(s, S_SIZE, stdin); if (!success) { perror("Failed reading hotel name"); exit(EXIT_FAILURE); }
Note how I handled the error. Every I/O is checked for errors, and the error message is in the user's terminology.
Also, do you know of an IDE for GCC ( in a similar manner to that provided by Borland C++) ? This would be very useful.
There are endless numbers of them, since most UNIX editors have good programming support. For example, in Emacs you create a Makefile containing the line t: t.c and type M-x compile (and the second thing you'll do in emacs is assign that command to a function key).
There is an excellent Borland-like IDE for beginners, and if you hunt around www.freshmeat.net you'll probably find it.
Brett Nash wrote:As an aside, if you don't have a good reference on C, I would suggest hunting down a copy of Brian Kernighan & Dennis Richies "The C Programming Language", a little expensive (~$70) for it's size (250pages), but you won't find a better reference ANYWHERE for C, with the possible exception of the ANSI standard, and K&R is much more readable. The reference manual section will allow you work out such issues very quickly (A2.6 covers string literals, and your specific problem quite concisely - I can post you the section if you wish).
Don't bother with the ANSI/ISO standard, they aren't meant to be textbooks. Standards necessarily have to deal with the odd and difficult to explain cases, and sometime need to be handwaving when the beginner needs strong advice (eg, overwriting a constant, standard says "undefined", textbook says "don't do that").
You should be able to pick up K&R second-hand with little trouble. Only bother with the 2nd edition if you are learning C.
A Book on C is a classic beginners text. Microsoft Press had a nice reference guide, but I think they reissued it as a book with a fair mark-up in the price. If you move to C++ or Java then Bruce Eckel's books are outstanding and online.
-- Glen Turner Tel: (08) 8303 3936 or +61 8 8303 3936 Australia's Academic & Research Network www.aarnet.edu.au -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
-- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
