f



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

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

0
Aladdin
7/26/2005 1:44:11 AM
comp.lang.c 30657 articles. 4 followers. spinoza1111 (3246) is leader. Post Follow

17 Replies
454 Views

Similar Articles

[PageSpeed] 11

On 25 Jul 2005 18:44:11 -0700, "Aladdin" <buaa_aladdin@163.com> wrote
in comp.lang.c:

> 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.

-- 
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
0
jackklein (3930)
7/26/2005 2:58:23 AM
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

0
Aladdin
7/26/2005 3:49:35 AM
On 25 Jul 2005 20:49:35 -0700, "Aladdin" <buaa_aladdin@163.com> wrote
in comp.lang.c:

> 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.

-- 
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
0
jackklein (3930)
7/26/2005 4:02:27 AM
[Please quote the relevant article that you're replying to. Usenet
is a distributed medium, and not all servers will receive all
posts.]

Aladdin wrote:
> 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

-- 
Peter

0
airia (1802)
7/26/2005 4:05:47 AM
OK. Thanks.

0
Aladdin
7/26/2005 4:58:32 AM
Aladdin wrote:
> 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.

-- 
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

0
websnarf (1153)
7/26/2005 6:36:19 AM
>> 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.

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

0
Aladdin
7/26/2005 7:39:31 AM
Aladdin wrote:
> 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.

http://david.tribble.com/text/cdiffs.htm perhaps.
0
devnull (219)
7/26/2005 7:58:10 AM
websnarf@gmail.com writes:
> Aladdin wrote:
>> 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.

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++.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*>  <http://users.sdsc.edu/~kst>
We must do something.  This is something.  Therefore, we must do this.
0
kst-u (21963)
7/26/2005 8:01:27 AM
On 25 Jul 2005 23:36:19 -0700, websnarf@gmail.com 
   <websnarf@gmail.com> wrote:

> Aladdin wrote:
>> 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.

Easily disproved, type long long for a start.

>> 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.

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

Chris C
0
chris23 (646)
7/26/2005 8:15:33 AM
Aladdin wrote
(in article 
<1122363570.945661.197780@g47g2000cwa.googlegroups.com>):

>>> 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.
> 
> 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.


-- 
Randy Howard (2reply remove FOOBAR)

0
randyhoward (4848)
7/26/2005 9:23:08 AM
websnarf@gmail.com wrote
(in article 
<1122359779.555950.206190@g43g2000cwa.googlegroups.com>):

> Aladdin wrote:
>> 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.

Not even close to correct.

-- 
Randy Howard (2reply remove FOOBAR)

0
randyhoward (4848)
7/26/2005 9:23:57 AM
websnarf@gmail.com wrote:
> Aladdin wrote:
> > 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.

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

>
> > 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.

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.

0
robert.thorpe (1138)
7/26/2005 9:39:35 AM
Aladdin wrote:
> >> 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.
>
> 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.

-- 
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

0
websnarf (1153)
7/26/2005 10:05:43 AM
Keith Thompson wrote:
> websnarf@gmail.com writes:
> > Aladdin wrote:
> >> 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.
>
> 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.

-- 
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

0
websnarf (1153)
7/26/2005 10:12:22 AM
Rob Thorpe wrote:
> websnarf@gmail.com wrote:
> > Aladdin wrote:
> > > 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.
>
> 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.

> > > 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.
>
> 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*.

-- 
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

0
websnarf (1153)
7/26/2005 10:14:14 AM
websnarf@gmail.com wrote:
> Rob Thorpe wrote:
> > websnarf@gmail.com wrote:
> > > Aladdin wrote:
> > > > 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.
> >
> > 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.

long long is another that someone else mentioned.

> > > > 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.
> >
> > 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*.

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.

0
robert.thorpe (1138)
7/26/2005 10:58:28 AM
Reply: