Making C better (by borrowing from C++)

R

Richard Heathfield

Chris Hills said:
Lower quality no... Better quality yes.

Then what you call "pedantry" (and others call "accuracy") must stay.
Being pedantically correct may be the wrong answer.

If the answer is correct *and* relevant, how can it be wrong?
Ie the usuall "there is no **** in C" from CBF when some one says
something that is not in ISO, K&R, ANSI-C or any N document but is used
by a very large number of C programmers.

Such replies are, unfortunately, correct. We might wish they were not -
that is, we might wish that C /did/ specify an interface to **** (on
occasion, at least) - but they are. I can think of better ways to put it
than "there is no **** in C", but it is certainly correct (unless it
isn't, in which case we can say "oh yes there is", and take it from
there).
Usually things that are not pertinent to the question concerned.

Incidentally most of the work I am involved in is high integrity or high
reliability. Portability is not a major concern. In fact I subject that
portability is a minority concern.

I don't know about you, but I think every single question deserves the best
possible answer. If the question is about ISO C, the chances are very high
that the best answer you'll get anywhere on Usenet can be found right here
in comp.lang.c - but if the question is about something else, the chances
are very high that you'll get a better answer in a group where the
question is topical. Platform-specific questions get better answers
elsenet.
 
M

Malcolm McLean

Chris Hills said:
Jacobs compilers are as free as GCC compilers. (And the MS & Borland ones)
He releases the executable free for personal use. The source is secret, and
he makes his money on commercial use.
gcc is open source and free for any use, so is freer than lcc-win, whilst MS
release a stripped down and, in my experience, barely useable compiler for
personal use, as long as no open-source or, as they say "virally
licenced"software is developed with it, and charge $$$$ for the full
version. So they are less free than lcc-win.

I am currently trying to decide whether to junk Windows for Linux. It is
just getting too much grief to get a Windows program up and running. I might
try the commerical version of the Vista compiler and see if I can actually
get anything useful done with it. However I don't really like X either, and
I want people to be able to run my stuff.
 
R

Richard Heathfield

Chris Hills said:
writes


Bloody good point! I had not thought of it that way.

It's a ludicrous argument, and a rather self-defeating point. He's saying
that a compiler vendor doesn't know C well enough to be considered a
"guru" - but surely a compiler vendor ought to know C better than
*anyone*! It certainly ought to be the case that he knows C better than I
do, which is why I find it rather strange that even he acknowledges that
he doesn't.

He's also ignoring the fact that the real guru here is Chris Torek, who
knows several hundred times as much about C as I will ever know.

However as Jacob's
compiler can be obtained for Free and Richards book can not Richard is
more commercial than Jacob :)

(get out of that one.....)

Since I've never, ever promoted the book here, the claim is without merit.
 
H

Honest Jon

Jacobs compilers are as free as GCC compilers. (And the MS & Borland ones)

You are mistaken. The gcc compilers are free software. MS, Borland and
lcc are all properietary software. In fact, you don't even have the
freedom to *run* Jacob's compiler for commercial use, still less view
and modify the source and all the other rights *everyone* has under the
standard meaning of "free".
 
M

Malcolm McLean

Richard Heathfield said:
If the answer is correct *and* relevant, how can it be wrong?
Say someone asks "how do I convert from the hex numbers in the machine to
decimal?".
A regular might say "sprintf will convert from the machine's representation,
which is in a format known as two's complement binary, to human-readable
ASCII characters".
You can guarantee that someone else will mention one's complement machines
and weird and wonderful character codes. Correct, and relevant, whether it
is useful or not depends on the tone. Sometimes it will usefully advance the
newbie's understanding a notch, other times it will confuse the newbie and
irritate the regular.
 
C

Chris Hills

Richard Heathfield said:
Chris Hills said:


Er, you did, actually. But I'll accept that you didn't mean to.

Hi Richard,

Thanks.

How come you are on line on boxing day? My excuse is we are doing a new
web site and I have Tax and company paperwork to do. (Also I am out
enjoying myself tomorrow, and had the last 3 days off)

Though unlike many I had the computers off for 36 hours from Christmas
eve. I am surprised how many people were on line yesterday.

Regards
Chris
 
J

jacob navia

Malcolm said:
He releases the executable free for personal use. The source is secret,
and he makes his money on commercial use.
gcc is open source and free for any use, so is freer than lcc-win,

No. If you want to use gcc source code you have to put YOUR application
under the GPL. And if you do not want to put YOUR application
under the GPL you have to pay BIG bucks to Red Hat.

RedHat (a for profit corporation that owns most of the
gcc centered business) makes millions of dollars of profits.

True, if you compile with gcc, you do not need to put
your application under the GPL. But it is the same for
my compiler as a matter of fact.
whilst MS release a stripped down and, in my experience, barely useable
compiler for personal use, as long as no open-source or, as they say
"virally licenced"software is developed with it, and charge $$$$ for the
full version. So they are less free than lcc-win.

They have the right to do so.
I am currently trying to decide whether to junk Windows for Linux. It is
just getting too much grief to get a Windows program up and running.

You just ask the lcc-win wizard to generate the skeleton for you.
Then you just fill the blanks.
I
might try the commerical version of the Vista compiler and see if I can
actually get anything useful done with it.

Most of the C library is "considered deprecated".


However I don't really like X
either, and I want people to be able to run my stuff.

Parse error. What did you wanted to say with the above sentence?
 
J

jacob navia

Richard said:
Since I've never, ever promoted the book here, the claim is without merit.

I must have been dreaming when you posted a discussion about the errata
in your book???
 
C

Chris Hills

Richard Heathfield said:
Chris Hills said:


It's a ludicrous argument,

Absolutely but so is getting at Jacob
and a rather self-defeating point. He's saying
that a compiler vendor doesn't know C well enough to be considered a
"guru" - but surely a compiler vendor ought to know C better than
*anyone*!

Maybe... Compiler vendors produce things they can sell.... or rather
things people want. GCC is hardly "ISO-C" and most embedded compilers
are non-standard.

Also some compiler writers I know re very good at writing compilers but
the for the actual language definition they refer to a standard... not
their memory. Their memory contains algorithms for writing compilers
many of which are used on lots of different languages
It certainly ought to be the case that he knows C better than I
do, which is why I find it rather strange that even he acknowledges that
he doesn't.

Yes. However he is producing a tool people want (as do MS) and if
enough people want the tool he is supplying then the ISO definition is
not so relevant. Sad but true.
Since I've never, ever promoted the book here, the claim is without merit.

Fair enough.

BTW What is "the book" called? Come on it's Christmas and I have asked
directly so give it a plug. Your book gets mentioned every now and
again so you may as well give the full information for those who don't
know.
 
C

Chris Hills

Malcolm McLean said:
He releases the executable free for personal use. The source is secret,
and he makes his money on commercial use.

So do many others. The fact the source is not open is irrelevant.
gcc is open source and free for any use,

So what?
so is freer than lcc-win

In some ways.
, whilst MS release a stripped down and, in my experience, barely
useable compiler for personal use,

In your opinion.
as long as no open-source or, as they say "virally licenced"software is
developed with it, and charge $$$$ for the full version. So they are
less free than lcc-win.
OK.

I am currently trying to decide whether to junk Windows for Linux.

I note that one of the main UK PC magazines in it's end of year top and
bottom 10 put Linux in it's bottom 10 (unless you are a geek) First time
I have seen that.

I also have a very good review of "Upgrade Vista XP" written as a
serious Vista-XP move.
It is just getting too much grief to get a Windows program up and
running. I might try the commerical version of the Vista compiler and
see if I can actually get anything useful done with it. However I don't
really like X either, and I want people to be able to run my stuff.

It's getting difficult. I agree... I will stay with XP until the Vista
replacement turns up or else move to OSX and Solaris.
 
C

Chris Hills

[QUOTE="jacob navia said:
He releases the executable free for personal use. The source is
secret, and he makes his money on commercial use.
gcc is open source and free for any use, so is freer than lcc-win,

No. If you want to use gcc source code you have to put YOUR application
under the GPL. And if you do not want to put YOUR application
under the GPL you have to pay BIG bucks to Red Hat.

RedHat (a for profit corporation that owns most of the
gcc centered business) makes millions of dollars of profits.[/QUOTE]

I note that all the management marketing and others get full commercial
salaries... the only people who don't are the programmers who actually
produce the main product they sell.

Turkeys voting for Christmas?
True, if you compile with gcc, you do not need to put
your application under the GPL. But it is the same for
my compiler as a matter of fact.

Errr it depends on the library you use. Use the wrong one and you DO
have to put your application out as OS.
You just ask the lcc-win wizard to generate the skeleton for you.
Then you just fill the blanks.


Most of the C library is "considered deprecated".

Since when?
However I don't really like X
Parse error. What did you wanted to say with the above sentence?


???
 
R

Richard Heathfield

jacob navia said:
No. If you want to use gcc source code you have to put YOUR application
under the GPL. And if you do not want to put YOUR application
under the GPL you have to pay BIG bucks to Red Hat.

Red Hat doesn't own gcc. And I can use gcc commercially without GPLing my
source and without paying anyone a bean. According to the lcc-win32 Web
page, the same is *not* true of lcc-win32.

<snip>
 
C

Chris Hills

You are mistaken. The gcc compilers are free software. MS, Borland and
lcc are all properietary software. In fact, you don't even have the
freedom to *run* Jacob's compiler for commercial use, still less view
and modify the source and all the other rights *everyone* has under the
standard meaning of "free".

GCC is proprietary It has a license just like MS, Borland and others.
 
E

Eric Sosman

jacob said:
Operator overloading is a technique that is well established and by all
means
not the latest fad.

You have no arguments Eric. Why would operator overloading
be a "fad"?

It is not the latest fad in C++ since many people are against it.
In fortran it was introduced YEARS ago.

Fortran also has (or had, back when it was FORTRAN) statement
functions, assigned GOTO, the IMPLICIT declaration, and a complete
absence of reserved words. Does that mean that all these things
would be "advances" for C?

Java's designers deliberately rejected operator overloading.
Since Java was developed more recently than C++ and Fortran, may
we conclude that it would "advance" both those languages if they
were now to discard overloading?

Finally, operator overloading is by no means the only fad you
promote. Your exact words were "many things that are necessary in
a modern software development environment," with no limitation on
or characterization of all these so-called "necessities." The
sole mechanism you suggest for deciding whether something would or
would not be a useful change to the language is "Whatever Jacob is
enthusiastic about is an `advance' and goes into Jacob's compiler,
which should by rights be the reference implementation for and
definition of C." Pfui!
I have repeated again and again the need to be able to create new types
of numbers
in C.

Thank you for informing us that you repeat yourself. Without
this disclosure, I cannot imagine how anyone would have found out.
There are two technical reports in the commitee discussion about
o decimal floating point numbers for exact operations
o fixed point representations.

Both are needed. How would you incorporate those into the language?

"Desired by some subgroup of people" does not equate to
"needed." Witness C99's introduction of complex types; the
overwhelming, pressing, "need" for these is surely the reason
why every vendor rushed rushed rushed to implement C99.
Don' you see that we can't change the language (and force all
implementations to support) all possible types of numbers?

Please explain how would YOU do this.

Do what, exactly? Do what you yourself say cannot be done?
 
J

jacob navia

Eric Sosman wrote:
[snip]
Finally, operator overloading is by no means the only fad you
promote. Your exact words were "many things that are necessary in
a modern software development environment," with no limitation on
or characterization of all these so-called "necessities."

I have published a document that contains my proposal in a very
detailed way. I can send it to you, but the
core of them is

o operator overloading
o references
o generic functions

The
sole mechanism you suggest for deciding whether something would or
would not be a useful change to the language is "Whatever Jacob is
enthusiastic about is an `advance' and goes into Jacob's compiler,
which should by rights be the reference implementation for and
definition of C." Pfui!

You do not want to discuss with any objectivity. Of course
the suggestions *I* do are the ones *I* consider right!

I explained all of them and why they are needed.
Thank you for informing us that you repeat yourself. Without
this disclosure, I cannot imagine how anyone would have found out.


"Desired by some subgroup of people" does not equate to
"needed." Witness C99's introduction of complex types; the
overwhelming, pressing, "need" for these is surely the reason
why every vendor rushed rushed rushed to implement C99.

They are needed for numerical calculations. The problem is that
not everyone does that.

Fixed point numbers ARE needed in machines where there is no floating
point hardware. Problem, not everyone has that environment.

Decimal floating point numbers ARE needed for doing exact
accounting calculations. Problem, not everyone is doing that.

The solution I propose would solve ALL those problems with
a SINGLE change.
Do what, exactly? Do what you yourself say cannot be done?

Use standard notation (+ - * or / ) to add, subtact multiply or
divide new kinds of numbers Eric, that's what I am saying again and
again.
 
M

Malcolm McLean

Chris Hills said:
So do many others. The fact the source is not open is irrelevant.


So what?
If a product is open source then in theory you can reengineer it. You can
keep your changes secret if they are for personal / in house use, but, for
obvious reasons, you may not sell the enhanced version.
In practise most people are not very interested. I did consider hacking into
gcc to make a 64 bit int compiler. Whilst I am pretty sure I have the
technical ability to do so, in practise the job seemed overwhelming, and I
haven't got beyond reading the GNU introductory pages.
I am not suggesting that Jacob go open source, by the way. It is huge
problem finding the right business model for software, and open source with
paid support isn't viable for everyone
It's getting difficult. I agree... I will stay with XP until the Vista
replacement turns up or else move to OSX and Solaris.
You seem to have to fiddle with the thing for hours just to get a little
window up on screen. The it declares all your code deprecated. So much that
you forget what you did to finally make it work. So next session its back to
square one. Then the code won't compile on the MSVC 6.0 we still use at the
university.
I really can't do with it.
 
C

Chris Hills

[QUOTE="jacob navia said:
Since when?

Since Microsoft got that technical report with its safe library, all
standard functions like fopen printf, etc provoke a warning.
[/QUOTE]

I know what you mean. That was the worst thing that happened to C.
Personally I voted against it.
 

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
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top