ANSI C Newbie Question

J

Joe Delphi

Hi,

I'm an experienced programmer, but new to ANSI C. I need to compile
ANSI C programs on Windows XP. The programs will mainly be console type
programs performing numerical calculations, in other words, I really don't
need a GUI for anything.

Which compiler should I buy or download?

I already have Visual Basic .NET and the .NET IDE on my computer.
Should I buy one of the other Microsoft compilers, like C#?

Should I just go for a public domain freeware compiler like GNU?

Something else?


JD
 
I

infobahn

Joe said:
Hi,

I'm an experienced programmer, but new to ANSI C. I need to compile
ANSI C programs on Windows XP. The programs will mainly be console type
programs performing numerical calculations, in other words, I really don't
need a GUI for anything.

Which compiler should I buy or download?

I already have Visual Basic .NET and the .NET IDE on my computer.
Should I buy one of the other Microsoft compilers, like C#?

No point. For one thing, C# is a different language! :)
Should I just go for a public domain freeware compiler like GNU?

gcc makes perfect sense for ANSI C (or ISO C, as we like to call it)
code.

mingw32 is a Win32 version of gcc which works just fine.
 
J

jacob navia

Joe said:
Hi,

I'm an experienced programmer, but new to ANSI C. I need to compile
ANSI C programs on Windows XP. The programs will mainly be console type
programs performing numerical calculations, in other words, I really don't
need a GUI for anything.

Which compiler should I buy or download?

I already have Visual Basic .NET and the .NET IDE on my computer.
Should I buy one of the other Microsoft compilers, like C#?

Should I just go for a public domain freeware compiler like GNU?

Something else?


JD

You can download the lcc-win32 IDE+compiler without charge from
http://www.cs.virginia.edu/~lcc-win32.

The IDE is quite advanced, and easy to use. You have several
wizards that allow you to get started easily.

Welcome to C!

jacob
 
D

Dave Vandervies

Joe said:
Hi,

I'm an experienced programmer, but new to ANSI C. I need to compile
ANSI C programs on Windows XP. The programs will mainly be console type
programs performing numerical calculations, in other words, I really don't
need a GUI for anything.
[snippage]

You can download the lcc-win32 IDE+compiler without charge from
http://www.cs.virginia.edu/~lcc-win32.

The IDE is quite advanced, and easy to use. You have several
wizards that allow you to get started easily.

Be aware that lcc-win32 has a large number of ...interesting... extensions
to the C language, and if I remember correctly (I could very well be
misremembering) Jacob Navia has told us in the past that he hasn't,
and doesn't intend to, implement a conforming mode that will reject
(or at least warn about) those extensions and compile standard C.

If you're interested in ANSI C and not Navia C, you're probably better
off with a compiler that can be persuaded to compile ANSI C. I use VC++
at work and have no serious complaints about it (it can be run from the
command line or through the IDE, and either way it's not difficult to
find the "I want ANSI C only" configuration), and there are also free
gcc-based ones.


dave
 
J

Joona I Palaste

Dave Vandervies said:
[snippage]
You can download the lcc-win32 IDE+compiler without charge from
http://www.cs.virginia.edu/~lcc-win32.

The IDE is quite advanced, and easy to use. You have several
wizards that allow you to get started easily.
Be aware that lcc-win32 has a large number of ...interesting... extensions
to the C language, and if I remember correctly (I could very well be
misremembering) Jacob Navia has told us in the past that he hasn't,
and doesn't intend to, implement a conforming mode that will reject
(or at least warn about) those extensions and compile standard C.

Has Jacob Navia *ever* written anything where he has not advertised his
own compiler lcc-win32? Jacob is a great programmer and his compiler is
a great program and all that, but honestly, this is a newsgroup about C,
not an advertisement forum for lcc-win32. If this keeps up, Jacob might
become the first non-troll I killfile.
 
E

Emmanuel Delahaye

Joe Delphi wrote on 25/02/05 :
Hi,

I'm an experienced programmer, but new to ANSI C. I need to compile
ANSI C programs on Windows XP. The programs will mainly be console type
programs performing numerical calculations, in other words, I really don't
need a GUI for anything.

Which compiler should I buy or download?

Try Dev-C++. It's good and free.

http://www.bloodshed.net/devcpp.html

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"Clearly your code does not meet the original spec."
"You are sentenced to 30 lashes with a wet noodle."
-- Jerry Coffin in a.l.c.c++
 
R

Randy Howard

If you're interested in ANSI C and not Navia C, you're probably better
off with a compiler that can be persuaded to compile ANSI C.

Correct. mingw, gcc included, you can then invoke it with
-std=c89, or =std=c99 if you like living on the edge
and the usual -O2 -Wall -pedantic etc.

You will be quite sure of portable code when you are done.
 
J

jacob navia

Dave said:
Be aware that lcc-win32 has a large number of ...interesting... extensions
to the C language, and if I remember correctly (I could very well be
misremembering) Jacob Navia has told us in the past that he hasn't,
and doesn't intend to, implement a conforming mode that will reject
(or at least warn about) those extensions and compile standard C.

When you invoke lcc-win32 with
lcc -ansic foo.c

*All* extensions are disabled.

This is
1) written in the documentation
2) It has an own button in the IDE
3) I have repeated it here at least once a month since at least
one year.

But nothing helps. There is no blinder man as the one that doesn't want
to see.
 
J

jacob navia

Joona said:
Has Jacob Navia *ever* written anything where he has not advertised his
own compiler lcc-win32? Jacob is a great programmer and his compiler is
a great program and all that, but honestly, this is a newsgroup about C,
not an advertisement forum for lcc-win32. If this keeps up, Jacob might
become the first non-troll I killfile.

See the threads:
o read vs fread (Feb 24)
o assembly in C (Feb 24)

to name some of the most recent posts. No mention of my compiler there.

Besides, the thread original poster wanted to know which IDE to use
on windows XP. So I answered him.

But it would be a nice idea to put all my posts in a killfile.
There is rarely something interesting coming from your side besides
this endless attacks because you like another compiler or because
whatever...

A killfile in your side would help us both.

A sad situation really.

jacob
 
I

infobahn

mingw, gcc included, you can then invoke it with
-std=c89, or =std=c99 if you like living on the edge
and the usual -O2 -Wall -pedantic etc.

You will be quite sure of portable code when you are done.

Alas, this is not the case. Would that it were!

Mix in a good C book and comp.lang.c, though, and the OP will be
well on his way.
 
J

jacob navia

Dave said:
If you're interested in ANSI C and not Navia C, you're probably better
off with a compiler that can be persuaded to compile ANSI C. I use VC++
at work and have no serious complaints about it (it can be run from the
command line or through the IDE, and either way it's not difficult to
find the "I want ANSI C only" configuration), and there are also free
gcc-based ones.


dave

Ahh you are so "STANDARD C" type of person. Look at this:

type example.c
int __declspec(dllexport ) a;
int main(void)
{
__try {
int a=0;
}
__except(0) {
int b=0;
}
}

cl -Za example.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

example.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/out:tstdcall.exe
tstdcall.obj
Creating library tstdcall.lib and object tstdcall.exp
----------------
As you can see, Microsoft C doesn't disable extensions even when told
to do so with the Za option.

But that is Microsoft, of course. Microsoft's C is accepted,
NAVIA C is despised because I am just a nobody.

jacob
 
D

Dave Vandervies

jacob navia said:
Ahh you are so "STANDARD C" type of person.

You say that as if it were a bad thing.


[snip example of invoking undefined behavior by using symbols in the
implementation's namespace that MSVC silently accepts]

But that is Microsoft, of course. Microsoft's C is accepted,
NAVIA C is despised because I am just a nobody.

If people post Microsoft C here, they'll get told that there are better
places to discuss it. Most of them are capable of understanding that.

If somebody from the Microsoft compiler development team were thick-
skulled enough to keep posting here about nifty new extensions in the
Microsoft compiler after they'd been told repeatedly that we're not
interested and they'd get a warmer reception elsewhere, they'd get
treated exactly the same way as you.


dave
 
F

Flash Gordon

jacob said:
Ahh you are so "STANDARD C" type of person. Look at this:

type example.c
int __declspec(dllexport ) a;

__declspec is in the implementation name space, the compiler is allowed
to do whatever it likes with it.
int main(void)
{
__try {

__try is in the implementation name space...
int a=0;
}
__except(0) {

__except is in the implementation name space...
int b=0;
}
}
cl -Za example.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

example.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/out:tstdcall.exe
tstdcall.obj
Creating library tstdcall.lib and object tstdcall.exp

Well, all the names where in the implementation name space, so the
implementation can do what it wants without diagnostics. Any
implementation could define macros like

#define __declspec(x)
#define __try
#define __except(x)

So it accepting that without diagnostics is still acceptable behaviour
according to the standard.
But that is Microsoft, of course. Microsoft's C is accepted,
NAVIA C is despised because I am just a nobody.

No, people get pissed off with you repeatedly pushing it's extensions.
Also your suggesting it earlier in this thread *without* stating your
interest does not sit well with me.
 
R

Randy Howard

Alas, this is not the case. Would that it were!

Mix in a good C book and comp.lang.c, though, and the OP will be
well on his way.

Yes, well, I should have known better than to make any sort of
statement in clc without at least a few weasel words thrown in.
 
J

jacob navia

Flash said:
No, people get pissed off with you repeatedly pushing it's extensions.

There weren't in my message any "pushing of any extensions"

I would really suggest you put me in your killfile.

Thanks in advance

jacob
 
P

Peter Nilsson

jacob said:
<snip OT M$ extensions>
NAVIA C is despised because I am just a nobody.

M$ and GNU are _NOT_ regularly posting to clc with the express
purpose of bringing the group into their way of thinking with
regards to C extensions.

Learn to make better use of _your own_ forums and avenues for
feature announcements, rather than trying to corrupt existing
forums for your own personal ends.
 
J

jacob navia

Peter said:
M$ and GNU are _NOT_ regularly posting to clc with the express
purpose of bringing the group into their way of thinking with
regards to C extensions.

Learn to make better use of _your own_ forums and avenues for
feature announcements, rather than trying to corrupt existing
forums for your own personal ends.

You are entitled to your opinion, I am entitled to mine.

It is free speech, here. You have

"the express purpose of bringing the group into your way of
thinking with regards to C extensions."

So, just go on, I will go on too.

Thanks for putting me in your killfile.

jacob
 
C

CBFalconer

infobahn said:
Randy Howard wrote:



Alas, this is not the case. Would that it were!

Mix in a good C book and comp.lang.c, though, and the OP will be
well on his way.

Add in -W and what is the problem? I think the result catches most
outright violations. It won't catch stupidities and faulty coding,
failure to check error returns, failure to ensure objects have the
capacity to hold the desired values, etc.
 
C

CBFalconer

jacob said:
.... snip ...

When you invoke lcc-win32 with
lcc -ansic foo.c

*All* extensions are disabled.

This is
1) written in the documentation
2) It has an own button in the IDE
3) I have repeated it here at least once a month since at least
one year.

But nothing helps. There is no blinder man as the one that
doesn't want to see.

Good, but the attitude doesn't help. I don't remember seeing point
3 at all, and the others only show up is one uses it. How do you
select between C90 and C99 standards?

How is the regression error checking suite coming?
 
C

CBFalconer

jacob said:
Ahh you are so "STANDARD C" type of person. Look at this:

type example.c

.... snip ugly non-standard code ...
cl -Za example.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

example.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/out:tstdcall.exe
tstdcall.obj
Creating library tstdcall.lib and object tstdcall.exp
----------------
As you can see, Microsoft C doesn't disable extensions even when told
to do so with the Za option.

But that is Microsoft, of course. Microsoft's C is accepted,
NAVIA C is despised because I am just a nobody.

Don't be hypersensitive. The problem here is that you push the
non-standard extensions in a newsgroup (c.l.c) where they are
off-topic. If you pushed standards adherence the reception would
be much better. But such things as overloading, operator
definition, and garbage collection are way out in left field for
c.l.c. Anything that uses them is automatically non-portable.
 

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

Forum statistics

Threads
474,139
Messages
2,570,805
Members
47,352
Latest member
DianeKulik

Latest Threads

Top