Where to get a compatibility list of C and C++?

A

Aladdin

Hi, all!

I'm looking for a list of features that are supported in C but not
supported in C++. I also need the complete list of language alterations
from K&R C to C89 then to C99.

Would anyone help? Thanks!

Aladdin
 
J

Jack Klein

Hi, all!

I'm looking for a list of features that are supported in C but not
supported in C++. I also need the complete list of language alterations
from K&R C to C89 then to C99.

Would anyone help? Thanks!

Aladdin

Homework?

C++, and the differences between C and C++, are completely off-topic
here. As far as the C language standard and this group are concerned,
the existence of C++ is barely noted.

As for the differences from ISO C90 to ISO C99, there is a summary in
the forward of the Standard itself. You can buy a copy of the
standard from ANSI for $18.00US, look for ISO 9899.

You can also download the last public draft of the 1999 standard free
in one of several formats from
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n869/. There are some
differences between this and the final official 1999 standard, and it
does not include the two TCs since 1999.

As for the differences between K&R C and ISO 90, can't think of a good
source off-hand.
 
A

Aladdin

Thanks a lot. I'm working on a compiler and constructing some
testcases.

I'm looking for the feature ***supported in C but not in C++***.
Because C++ is designed back-compatible with C, such features may be
exceptional. But I know they exists, e.g. legacy language features.

It's my first time raise a question here. If this problem is off-topic
here, could you tell me where to post it?

Aladdin
 
J

Jack Klein

Thanks a lot. I'm working on a compiler and constructing some
testcases.

I'm looking for the feature ***supported in C but not in C++***.
Because C++ is designed back-compatible with C, such features may be
exceptional. But I know they exists, e.g. legacy language features.

It's my first time raise a question here. If this problem is off-topic
here, could you tell me where to post it?

Aladdin

comp.lang.c++ would be the place to research the differences between
C++ and C. The C++ standard bases itself on the older (1995) version
of the C standard. Try their FAQ, link in my signature.
 
P

Peter Nilsson

[Please quote the relevant article that you're replying to. Usenet
is a distributed medium, and not all servers will receive all
posts.]
Thanks a lot. I'm working on a compiler and constructing some
testcases.

I'm looking for the feature ***supported in C but not in C++***.
Because C++ is designed back-compatible with C, such features may be
exceptional. But I know they exists, e.g. legacy language features.

It's my first time raise a question here. If this problem is off-
topic here, could you tell me where to post it?

comp.lang.c and comp.std.c can help you with specific interpretations
of given language features. There are other specific compiler
writing newsgroups too.

But you should really familiarise yourself with the language
standards for both languages. There's an excellent compilation
on the differences between C99 and C++ at...

http://david.tribble.com/text/cdiffs.htm
 
W

websnarf

Aladdin said:
Thanks a lot. I'm working on a compiler and constructing some
testcases.

I'm looking for the feature ***supported in C but not in C++***.

Oh that's easy; there are none.
Because C++ is designed back-compatible with C, such features may be
exceptional. But I know they exists, e.g. legacy language features.

There are differences, but no drop in features. Unless you consider
things like a seperate struct name space as actually a feature.
 
A

Aladdin

Because C++ is designed back-compatible with C, such features may be
There are differences, but no drop in features. Unless you consider
things like a seperate struct name space as actually a feature.

I'm not sure about that. Isn't there a piece of C code that can not be
accpted by a standard C++ compiler?

What do you mean by 'feature'? I consider it at both syntax and
semantics issues.

Aladdin
 
K

Keith Thompson

Oh that's easy; there are none.


There are differences, but no drop in features. Unless you consider
things like a seperate struct name space as actually a feature.

restrict and long long spring to mind; I'm sure there are others.

I think most of the features that are in C99 but not in C90 are not in
C++.
 
C

Chris Croughton

Oh that's easy; there are none.

Easily disproved, type long long for a start.
There are differences, but no drop in features. Unless you consider
things like a seperate struct name space as actually a feature.

I consider a 64 bit (or better) integral type to be a feature.

Chris C
 
R

Randy Howard

Aladdin wrote
(in article
I'm not sure about that. Isn't there a piece of C code that can not be
accpted by a standard C++ compiler?

Lots of them. Consider this:

int new;

Oops.
 
R

Rob Thorpe

Oh that's easy; there are none.

There are several. Try porting a C program to C++ and you'll soon find
them.
There are differences, but no drop in features. Unless you consider
things like a seperate struct name space as actually a feature.

The semantics of void * are different in C to C++. In C++ void* must
often be cast, but not in C. I consider the C semantics more useful.
 
W

websnarf

Aladdin said:
I'm not sure about that. Isn't there a piece of C code that can not be
accpted by a standard C++ compiler?

Yes, but the OP was asking about *FEATURES* not, exactly syntax or
semantics.
What do you mean by 'feature'? I consider it at both syntax and
semantics issues.

Ok, I don't. C++ and C both support structs and typedefs. Does C
support a different *feature* because they can use the same name for a
typedef, and struct at the same time? That isn't a different feature,
that's just a detail.
 
W

websnarf

Keith said:
restrict and long long spring to mind; I'm sure there are others.

These features will always exist in at least as many C++ compilers as C
compilers. Specifically, there exists no possible scenario by which a
programmer could ever be in a situation where they want or need either
of those features and be forced to give up on C++ and use C because of
this.
I think most of the features that are in C99 but not in C90 are not in
C++.

Right, but C99 is an unimplemented paper standard, and these features
exist in C compilers only as a strict proper subset of their existence
in their associated C++ compilers.
 
W

websnarf

Rob said:
There are several. Try porting a C program to C++ and you'll soon find
them.

Been doing this off and on for years. Haven't encountered any such
phantom features so far.
The semantics of void * are different in C to C++. In C++ void* must
often be cast, but not in C. I consider the C semantics more useful.

Yes, but I don't call that a *FEATURE*.
 
R

Rob Thorpe

Been doing this off and on for years. Haven't encountered any such
phantom features so far.

long long is another that someone else mentioned.
Yes, but I don't call that a *FEATURE*.

I suppose it depends on how small a thing you call a feature.

I once ported an interpreted language from C to C++. It used a great
number of void pointers to deal with functions in the C library that
the language called. Porting it to C++ made it slightly longer and
more difficult to read. In that, very unusual, case it was definitely
a feature.
 

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,774
Messages
2,569,598
Members
45,161
Latest member
GertrudeMa
Top