Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > John McCarthy died today.

Reply
Thread Tools

John McCarthy died today.

 
 
Kenny McCormack
Guest
Posts: n/a
 
      11-10-2011
In article <(E-Mail Removed)>,
Keith Thompson <(E-Mail Removed)> wrote:
>Nick Keighley <(E-Mail Removed)> writes:
>> On Nov 9, 9:25*pm, Keith Thompson <(E-Mail Removed)> wrote:
>> <snip>

>[...]
>>> Oh, and try getting agreement from the C++ standard committee while
>>> you're at it. *And Objective-C (I don't know whether there's a
>>> committee for that, but Objective-C is closely upward-compatible
>>> with C).

>>
>> what about C#, Java, Python
>> or is that just too much?

>
>If C made such a change, there would be no particular motivation
>for C#, Java, or Python to follow suit. C++ and Objective-C have
>C compatibility as a significant selling point.


Add AWK & Perl to the list. The point is that one of the selling points of
those languages is that the syntax (including the structure and the
operators) is C-like. If you change C, then they'd either have to change as
well, or lose that selling point.

And anyway, isn't it a standard dogma of this group that C and C++ are
completely different languages with almost nothing in common? That's what I
hear all the time...

--
(This discussion group is about C, ...)

Wrong. It is only OCCASIONALLY a discussion group
about C; mostly, like most "discussion" groups, it is
off-topic Rorsharch [sic] revelations of the childhood
traumas of the participants...

 
Reply With Quote
 
 
 
 
Lauri Alanko
Guest
Posts: n/a
 
      11-10-2011
In article <(E-Mail Removed)>,
Nick Keighley <(E-Mail Removed)> wrote:
> On Nov 9, 9:25*pm, Keith Thompson <(E-Mail Removed)> wrote:
> > Changing "=" to ":=" as you propose is an all-or-nothing change.


> > Oh, and try getting agreement from the C++ standard committee while
> > you're at it.


> what about C#, Java, Python
> or is that just too much?


Python does not have assignment expressions, so the issue is moot.


Lauri
 
Reply With Quote
 
 
 
 
Phil Carmody
Guest
Posts: n/a
 
      11-10-2011
"BartC" <(E-Mail Removed)> writes:
> "Phil Carmody" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Kaz Kylheku <(E-Mail Removed)> writes:

>
> >> Speaking of which, even though Java is not meant to be compatible
> >> with C, its
> >> assignment operator is = and comparison is ==.
> >>
> >> Oops!

> >
> > As is JavaScript's, and perl's, and LUA's, and python's ...
> >
> > Was the decision really such a bad mistake if it's been willingly
> > repeated so often?

>
> Those languages were likely implemented in C. In which case, they
> would be quite receptive to the idea of using "=" and "==".


Probably so. They didn't consider themselves hostages to some
egregious 'mistake', that they had to escape from forthwith,
that's for sure. It still makes them valid data points against
the hypothesis that the choice was a mistake.

> And if they had considered using ":=" and "=" instead, they would
> quickly have found that mixing up ":="/"=" and "="/"==" (between
> writing the C code and testing fragments of the new language) caused
> too many problems!


In some of those languages, the visual similarity is minuscule, so I
don't think that would be an issue - their test inputs are simply not
comparable to the language the compiler/interpreter's written in.

> > I'll pin my colours to the mast - I do not consider the choice of those
> > tokens to be a mistake.

>
> In the original C, or the derived languages?


In C. And I support its borrowing in all languages that want to inherit
some C-like syntax, as long as holistically it's coherent enough.

> Once the decision to use
> "=" for assignment in C was made, using "==" for equality was
> reasonable.


No more or less reasonable than something like =?, though. OK, the
set of arbitrary and vaguely sensible things it could have been isn't
huge, but it's certainly not a singleton.

> Using .EQ. would be too naff, and using context was not
> possible as assignments also occur in expressions.
>
> (I think PL/I allowed "=" for both assignment/equality, maybe it did
> use context, but that was quite hairy to implement anyway.)


Whilst I don't have a background in those languages, I do not feel
that I am lacking in any way! (But I'm happy to have studied scheme,
for example.)

Phil
--
Unix is simple. It just takes a genius to understand its simplicity
-- Dennis Ritchie (1941-2011), Unix Co-Creator
 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a
 
      11-12-2011
On Thu, 2011-11-10, Kenny McCormack wrote:
....
> And anyway, isn't it a standard dogma of this group that C and C++ are
> completely different languages with almost nothing in common? That's what I
> hear all the time...


They are completely different languages, with a lot in common.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
Kaz Kylheku
Guest
Posts: n/a
 
      11-13-2011
On 2011-11-12, Jorgen Grahn <(E-Mail Removed)> wrote:
> On Thu, 2011-11-10, Kenny McCormack wrote:
> ...
>> And anyway, isn't it a standard dogma of this group that C and C++ are
>> completely different languages with almost nothing in common? That's what I
>> hear all the time...

>
> They are completely different languages, with a lot in common.


Your English dictionary must have something bizarre under the "completely"
entry.
 
Reply With Quote
 
Charles Richmond
Guest
Posts: n/a
 
      11-13-2011
"Kaz Kylheku" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On 2011-11-12, Jorgen Grahn <(E-Mail Removed)> wrote:
>> On Thu, 2011-11-10, Kenny McCormack wrote:
>> ...
>>> And anyway, isn't it a standard dogma of this group that C and C++ are
>>> completely different languages with almost nothing in common? That's
>>> what I
>>> hear all the time...

>>
>> They are completely different languages, with a lot in common.

>
> Your English dictionary must have something bizarre under the "completely"
> entry.


It is analogous to what George Bernard Shaw said:

"England and America are two countries separated by a common language."

--
+<><><><><><><><><><><><><><><><><><><>+
| Charles Richmond http://www.velocityreviews.com/forums/(E-Mail Removed) |
+<><><><><><><><><><><><><><><><><><><>+

 
Reply With Quote
 
Kaz Kylheku
Guest
Posts: n/a
 
      11-13-2011
On 2011-11-13, Charles Richmond <(E-Mail Removed)> wrote:
> "Kaz Kylheku" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> On 2011-11-12, Jorgen Grahn <(E-Mail Removed)> wrote:
>>> On Thu, 2011-11-10, Kenny McCormack wrote:
>>> ...
>>>> And anyway, isn't it a standard dogma of this group that C and C++ are
>>>> completely different languages with almost nothing in common? That's
>>>> what I
>>>> hear all the time...
>>>
>>> They are completely different languages, with a lot in common.

>>
>> Your English dictionary must have something bizarre under the "completely"
>> entry.

>
> It is analogous to what George Bernard Shaw said:
>
> "England and America are two countries separated by a common language."


I'm working on a program that can be built either with a C or C++ compiler.
Most of the time I forget about this, losing my awareness of "this has to be
valid C++ too", and I neglect to build it as C++ for weeks or months.

Yet, the C++ port very rarely breaks and is easy to fix.

I just tried a C++ build: zero warnings! According to the ChangeLog, the last
time I did C++-related maintenance was on Oct 2, which was 131 commits ago. So
did 131 commits to a C program without caring that it's also C++, yet it still
compiles cleanly as C++.

C++ is a very close dialect of C, and can easily be treated as another porting
target for a C program.
 
Reply With Quote
 
Kenny McCormack
Guest
Posts: n/a
 
      11-13-2011
In article <(E-Mail Removed)>,
Kaz Kylheku <(E-Mail Removed)> wrote:
....
>C++ is a very close dialect of C, and can easily be treated as another porting
>target for a C program.


uh oh. Kiki isn't going to like this...

--
Just for a change of pace, this sig is *not* an obscure reference to
comp.lang.c...

 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      11-13-2011
Kaz Kylheku <(E-Mail Removed)> writes:
[...]
> I'm working on a program that can be built either with a C or C++ compiler.
> Most of the time I forget about this, losing my awareness of "this has to be
> valid C++ too", and I neglect to build it as C++ for weeks or months.

[...]

Out of curiosity, why are you doing this? What advantage do you gain
by writing code that can compile in either language? Conversely,
what would you lose by not worrying at all about C++ compatibility
(go ahead and call that variable "class" if you like)?

My impression is that the actual need for this is much rarer than
many people seem to think it is. (I do not include you in those
"many people").

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
Kaz Kylheku
Guest
Posts: n/a
 
      11-14-2011
On 2011-11-13, Keith Thompson <(E-Mail Removed)> wrote:
> Kaz Kylheku <(E-Mail Removed)> writes:
> [...]
>> I'm working on a program that can be built either with a C or C++ compiler.
>> Most of the time I forget about this, losing my awareness of "this has to be
>> valid C++ too", and I neglect to build it as C++ for weeks or months.

> [...]
>
> Out of curiosity, why are you doing this? What advantage do you gain
> by writing code that can compile in either language?


I can write in a "better C", which is safer, but still compiles with C
compilers.

> Conversely,
> what would you lose by not worrying at all about C++ compatibility
> (go ahead and call that variable "class" if you like)?


One example would be that I can't build the code any more with C++ to check
that all external names are meeting type-safe linkage and the one-definition
rule.

In C, I can have "extern int x;" in in one module, and "struct foo x = { 0 };"
in another. It will link.

If you change a C program such that a function has different parameters, but
due to some broken dependencies in your build system, some dependent modules
are not recompiled, you will get a broken link. Of course, it goes away
if you do a complete rebuild, but you could waste time chasing a bug
which isn't there.

This is fixed in C++: it will catch your broken build system. Type
safe linkage won't let an int (int, char *) call go to an
int (int, char *, char *) function.

(Ironically, I had such a problem recently and didn't catch it because
I had the project configured for the C compiler!)

The real question is, why not break away from C compatibility
and just use arbitrary C++?

That's the real reason for doing this: portability. I believe that C compilers
are still more widely available. Also more widely installed. If we look at just
GNU/Linux systems, g++ will never be present without gcc. But gcc will be
present without g++.

By the way, coding this way may come upon you as a feature request
from users! Years ago I developed that Kazlib library and I made sure
the headers were squeaky clean for C++ use.

But what did some people do? They took the .c files into their C++ projects and
compiled them as C++. So I got e-mails like, "hey your code breaks C++,
can we patch it".

This is probably one niche area where you need to write
in this common dialect: whitebox-reuse libraries that can be dropped
into C or C++ projects.

That's probably when I became more receptive to the idea that hey;
you can write C and C++ at the same time.

> My impression is that the actual need for this is much rarer than
> many people seem to think it is. (I do not include you in those
> "many people").


It's usually not a need, but an easily obtained "nice to have".

You won't see this done very often not because it is awkward or cumbersome
(which it isn't) but because (no surprise) most of the development world
doesn't really care about portability at all, let alone portability of C++ code
to C compilers.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DVD Verdict reviews: JOHN WAYNE-JOHN FORD FILM COLLECTION and more! DVD Verdict DVD Video 0 06-06-2006 08:23 AM
Printer & File Sharing Died =?Utf-8?B?Sm9obiBSYXR6ZW5iZXJnZXI=?= Wireless Networking 10 06-18-2005 07:50 PM
format first name from -john- to -John- ? RN ASP .Net 3 02-27-2005 05:34 AM
REVIEW: "The Hanged Man's Song", John Sandford (John Camp) Rob Slade, doting grandpa of Ryan and Trevor Computer Security 0 01-26-2004 04:28 PM
REVIEW: "The Devil's Code", John Sandford (John Camp) Rob Slade, doting grandpa of Ryan and Trevor Computer Security 0 07-03-2003 06:43 PM



Advertisments