Which compiler for a learner of C?

P

pkirk25

I own a legit copy of Visual C++ 6.0

Its nice but it is 10 years old and aimed at C++.

Downloaded Bloodshed Dev-C++

Very nice but the default auto-indent woupd break my heart as I depend
on indentation. This is how a loop is formatted by default.

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
int a = 0, b = 7;

for (a = 0; a <= b; ++a)
{
printf("Hello again\n");
}


system("PAUSE");
return 0;
}

That } that fails to align as it closes the "for" loop really puts me
off. If anyone knows how to fix this, this looks a fine compiler. Is
it good in the opinion of more experienced C programmers?

Is Visual C++ Express a good compiler?

Is there another for the Win32 platform that is recommended?
 
J

jacob navia

pkirk25 said:
I own a legit copy of Visual C++ 6.0

Its nice but it is 10 years old and aimed at C++.

Downloaded Bloodshed Dev-C++

Very nice but the default auto-indent woupd break my heart as I depend
on indentation. This is how a loop is formatted by default.

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
int a = 0, b = 7;

for (a = 0; a <= b; ++a)
{
printf("Hello again\n");
}


system("PAUSE");
return 0;
}

That } that fails to align as it closes the "for" loop really puts me
off. If anyone knows how to fix this, this looks a fine compiler. Is
it good in the opinion of more experienced C programmers?

Is Visual C++ Express a good compiler?

Is there another for the Win32 platform that is recommended?

Look lcc-win32 is a compiler system written for developing in C.
Not in C++.

Download it from
http://www.cs.virginia.edu/~lcc-win32

It is a controversial compiler but it comes with more than
Bloodshed, that is (apparently) no longer developed.

There is also a problem with the libraries.

This program:
#include <stdio.h>
int main(int argc, char *argv[])
{
long double d = 1e600L;

printf("%Le\n",d);
return 0;
}
will print
1.000000e+600
in lcc-win32, but in Bloodshed will print
-7.521098e-238

The libraries are not in phase with the compiler (gcc).
The program compiles with no warnings under Bloodshed,
but it gives wrong results.

http://www.cs.virginia.edu/~lcc-win32
 
R

Richard Heathfield

pkirk25 said:
I own a legit copy of Visual C++ 6.0

Its nice but it is 10 years old and aimed at C++.

It still does C just fine, though. It's a very good C compiler with a fine
IDE. In fact, on the rare occasions when I use Windows, it's my C compiler
of choice. (And I'm Mr Anti-Microsoft!)
 
J

jacob navia

Richard said:
pkirk25 said:




It still does C just fine, though. It's a very good C compiler with a fine
IDE. In fact, on the rare occasions when I use Windows, it's my C compiler
of choice. (And I'm Mr Anti-Microsoft!)
The flaw that I pointed out doesn't disturb you of course:

This program:
#include <stdio.h>
int main(int argc, char *argv[])
{
long double d = 1e600L;

printf("%Le\n",d);
return 0;
}
will print
1.000000e+600
in lcc-win32, but in Bloodshed will print
-7.521098e-238

The libraries are not in phase with the compiler (gcc).
The program compiles with no warnings under Bloodshed,
but it gives wrong results.

What flaws are concerned, you seem to be very selective...
 
P

pkirk25

Jacob,

First off, let me say I respect waht you have already achieved.

As is often the case when people start with flowery openings, I'm
afraid I must say that your compiler is not for me.

For my first try, i just said no to usign a wizard for ny "hello world"
application.

The editor behaves like a DOS EDIT program. No syntax highlighting, no
folding, just a text file. vi with ctags is more user friendly.

Files are saved with the name you give them. My "hello world" failed
to compile because I didn't save the file as main.c as opposed to main.

I then tried the wizard. It presented me with 62 lines of code!

Usual options like Ctrl-A for the Editor to Select All didn't work.

As I have no idea which of the 62 lines are essential to my "Hello
World" appliaction and which are not, I quit.

So far, so hard for a learner. Then I did get annoyed about the
documentation.

Documentation in pdf? Really, given that the web is over 15 years old,
there is no excuse for using pdf where html offers more ease of use.

Microsoft with a building full of IDE experts on the Washington campus
edged you. I hope that isn't too hurtful.

Thanks for the link and work you have done.
 
R

Richard Heathfield

jacob navia said:
I recommend it.

Well well. There's a surprise.
He was not asking for YOUR recommendation

Indeed - but I doubt whether he will consider your recommendation impartial,
given that you are the maintainer for lcc-win32.
 
R

Richard Heathfield

jacob navia said:
The flaw that I pointed out doesn't disturb you of course:

No, it doesn't. The flaw you pointed out is to do with Bloodshed's
implementation, not Visual C++ 6.0.

What flaws are concerned, you seem to be very selective...

Yes. When discussing Visual C++ 6.0, I do not find flaws in the Bloodshed
implementation to be particularly relevant.

Will you never tire of being *wrong*?
 
K

Keith Thompson

pkirk25 said:
Jacob,

First off, let me say I respect waht you have already achieved.

As is often the case when people start with flowery openings, I'm
afraid I must say that your compiler is not for me. [snip]
Thanks for the link and work you have done.

Let me suggest to both of you that comp.compilers.lcc would be the
appropriate place to discuss this.
 
J

Jack Klein

jacob navia said:


But he asked for one that is recommended.

Richard, are you ever going to get your head out of your ass, or has
picking on Jacob become your mission in life?

It is one thing, perhaps, to rebuke him when he answers a question by
pointing out a non-standard extension that his compiler has. But your
reply in this particular case smacks of nothing so much as personal
harassment or perhaps a vendetta of some sort.

Have you ever actually installed and used a version of lcc-win32? It
may be a bit hard to understand, but it is actually quite useful for
many things, and the non-standard extensions do not have to be used.

I have used his compiler, and Pelle's C, on occasion for algorithm
tests where I can write code cleanly and still receive enormous
performance improvements over Microsoft, Borland, and others, merely
because they support C99's inline functions.

Just what are your issues with Jacob and his compiler? I agree,
sometimes his posts stray off-topic, but the notion of adding language
extensions to a compiler is not something he initiated. Indeed, if it
were not for the fact that the C standard is in maintenance mode just
now, the best way to get extensions added to future standards is not
just to propose them, but to point to successful implementations. And
Jacob is doing just that.

Continuing to criticize lcc-win32 without producing examples of
incorrect code if produced, and continuing to criticize Jacob when, as
in this case, there was absolutely nothing off-topic about his reply,
is beginning to make you look like a pompous ass, or perhaps a troll.

How about giving it a rest?
 
N

napi

pkirk25 said:
I own a legit copy of Visual C++ 6.0

Its nice but it is 10 years old and aimed at C++.

Downloaded Bloodshed Dev-C++

Very nice but the default auto-indent woupd break my heart as I depend
on indentation. This is how a loop is formatted by default.

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
int a = 0, b = 7;

for (a = 0; a <= b; ++a)
{
printf("Hello again\n");
}


system("PAUSE");
return 0;
}

That } that fails to align as it closes the "for" loop really puts me
off. If anyone knows how to fix this, this looks a fine compiler. Is
it good in the opinion of more experienced C programmers?

Is Visual C++ Express a good compiler?

Is there another for the Win32 platform that is recommended?

AMPC is a C compiler (not C++) that you can try. The trial version is
available for download at:
http://www.axiomsol.com/hedesu/fm/

Napi
 
R

Richard Heathfield

Jack Klein said:
Richard, are you ever going to get your head out of your ass, or has
picking on Jacob become your mission in life?

Not at all. If it is suddenly unacceptable in this newsgroup to point out
errors and sloppy thinking, then I guess someone forgot to include me on
the email circular.
It is one thing, perhaps, to rebuke him when he answers a question by
pointing out a non-standard extension that his compiler has. But your
reply in this particular case smacks of nothing so much as personal
harassment or perhaps a vendetta of some sort.

No, I'm just pointing out that, as far as I'm aware, lcc-win32 is not
recommended by anyone except, it transpires, Mr Navia. Am I wrong? Do you,
for example, recommend lcc-win32?
Just what are your issues with Jacob and his compiler?

I have no issues with Mr Navia or with his compiler. I do, however, take
issue with some of the things Mr Navia says. His statements are often
incorrect and often stray off-topic in a continual bid to draw attention to
his product - which, in a technical newsgroup such as this, constitutes an
abuse. You know this already, I'm sure.

So - when he gets stuff wrong, what are we going to do? Ignore it, because
he maintains a compiler? I Don't Think So.

<snip>
 
C

Cong Wang

pkirk25 said:
I own a legit copy of Visual C++ 6.0

Its nice but it is 10 years old and aimed at C++.

Downloaded Bloodshed Dev-C++

Very nice but the default auto-indent woupd break my heart as I depend
on indentation. This is how a loop is formatted by default.

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
int a = 0, b = 7;

for (a = 0; a <= b; ++a)
{
printf("Hello again\n");
}


system("PAUSE");
return 0;
}

That } that fails to align as it closes the "for" loop really puts me
off. If anyone knows how to fix this, this looks a fine compiler. Is
it good in the opinion of more experienced C programmers?

Is Visual C++ Express a good compiler?

Is there another for the Win32 platform that is recommended?


VC++ is *NOT* recommended. Because it even does't know the common
sense! When I had to use it in a lab of my university, it even
highlighted the word 'new' and 'this' in my **C** code. And moreover,
it always gives fewer warnings, most of which are proved to be very
important, than gcc.
Dev-C++ is smaller, and I think, it is better than VC++. ;-p
 
J

jaysome

Jack Klein said:


Not at all. If it is suddenly unacceptable in this newsgroup to point out
errors and sloppy thinking, then I guess someone forgot to include me on
the email circular.


No, I'm just pointing out that, as far as I'm aware, lcc-win32 is not
recommended by anyone except, it transpires, Mr Navia. Am I wrong? Do you,
for example, recommend lcc-win32?


I have no issues with Mr Navia or with his compiler. I do, however, take
issue with some of the things Mr Navia says. His statements are often
incorrect and often stray off-topic in a continual bid to draw attention to
his product - which, in a technical newsgroup such as this, constitutes an
abuse. You know this already, I'm sure.

So - when he gets stuff wrong, what are we going to do? Ignore it, because
he maintains a compiler? I Don't Think So.

One of the questions that Jack asked that you did not answer is:

Have you ever actually installed and used a version of lcc-win32?

What's your answer?
 
P

pkirk25

I've been playing with C in the evenings for a week now and any
problems I have will not be solved by moving to a newer compiler.

Thanks for the advice and for the chance to try out a few different
options.
 
J

jacob navia

pkirk25 said:
Jacob,

First off, let me say I respect waht you have already achieved.

As is often the case when people start with flowery openings, I'm
afraid I must say that your compiler is not for me.

For my first try, i just said no to usign a wizard for ny "hello world"
application.

The editor behaves like a DOS EDIT program. No syntax highlighting, no
folding, just a text file. vi with ctags is more user friendly.

Obvious. You named your file "main" and NOT "main.c". The editor
can't know which language you use.
Files are saved with the name you give them. My "hello world" failed
to compile because I didn't save the file as main.c as opposed to main.

Yes. Since 30 years (more or less) C programs are saved in files that
have the .c extension. If you want to innovate, sorry but the
editor doesn't know about it.
I then tried the wizard. It presented me with 62 lines of code!

Yes. So what?
Usual options like Ctrl-A for the Editor to Select All didn't work.

As I have no idea which of the 62 lines are essential to my "Hello
World" appliaction and which are not, I quit.

There is a routine to parse arguments, and a help message already
in the skeleton for a program. But if you can't read plain C...
well you have to learn it.

So far, so hard for a learner. Then I did get annoyed about the
documentation.

Documentation in pdf? Really, given that the web is over 15 years old,
there is no excuse for using pdf where html offers more ease of use.

The documentation is in CHM form. You access with the "Help" button in
the IDE. The PDF is a tutorial.
Microsoft with a building full of IDE experts on the Washington campus
edged you. I hope that isn't too hurtful.
No

Thanks for the link and work you have done.

You are welcome.
 
M

Michael Mair

Richard said:
pkirk25 said:

It still does C just fine, though. It's a very good C compiler with a fine
IDE. In fact, on the rare occasions when I use Windows, it's my C compiler
of choice. (And I'm Mr Anti-Microsoft!)

Hmmm, that may be true for small to middle projects.
However, the fact that some of the standard headers lead to warnings,
that you cannot rely on the optimisation to produce the same programme
behaviour as unoptimised code, and that it cannot compile and link
projects of a certain size in Debug mode make it a beginners' tool in
my eyes.

As for the last two points: VS2005 looks much better in these respects.
I evaluated it only for a short time, though.
<OT>
For C++ code, I still got many warnings out of standard headers.
Fills one with confidence.
</OT>


Cheers
Michael
 
M

Michael Mair

pkirk25 said:
I've been playing with C in the evenings for a week now and any
problems I have will not be solved by moving to a newer compiler.

Thanks for the advice and for the chance to try out a few different
options.

You seemed to look more for an IDE than another compiler.

One recommendation: Turn up the warning level and disable MS extensions.
If your programme does not do what you expect but the compiler issues
no diagnostics, try compiling with gcc on a reasonable warning level,
e.g.
gcc -std=c89 -pedantic -Wall -O myprog.c -c
(the -c will suppress linking).
You can do this either using mingw (which is what Bloodshed uses IIRC)
or via Cygwin (installing Cygwin just for gcc may a little bit much,
though).
Some problems will not be caught by the above; then you can use splint
or other lint programmes.


Cheers
Michael
 
R

Richard Heathfield

Cong Wang said:

VC++ is *NOT* recommended.

I wouldn't hesitate to recommend it, certainly anything up to Version 6.
When they went .NET, MS screwed with it somewhat, and I'm not entirely sure
I like the changes they made (translation: I really, really *don't* like
those changes!) - but it's still a reasonable IDE over a reasonable
compiler.
Because it even does't know the common
sense! When I had to use it in a lab of my university, it even
highlighted the word 'new' and 'this' in my **C** code.

Yeah, I know. But despite a few glitches like that, it's a very good
product, and the compiler understands (or rather, correctly chooses not to
understand!) 'new' and 'this' just fine.
And moreover,
it always gives fewer warnings, most of which are proved to be very
important, than gcc.

Have you tried disabling Microsoft extensions and cranking up to warning
level 4? It's no lint, I agree, but it's reasonable nonetheless.
Dev-C++ is smaller, and I think, it is better than VC++. ;-p

Not having used Dev-C++ myself as far as I can remember, I must rely on what
I hear from people I respect who have used it. From such reports, I gather
that it is not sufficiently bad to warn people away from, nor sufficiently
good to rave about and sell your kids into slavery for. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top