in reply to Re: Perl6: Choosing language version in the shebang line?
in thread Perl6: Choosing language version in the shebang line?

If you mean that C++ is a "different" language than C, that is wrong. C++ is a superset of C. This backward compatibility required a lot compromises. Ancient C code will compile using a C++ compiler.

Sorry, but while most C code will compile using a C++ compiler, C++ is not a superset of C, and there is code that a C++ compiler won't compile successfully. There are C constructs that a C++ compiler will refuse; and extensions of newer C standards (like C99) are not available in a C++ compiler. Also, some constructs behave differently in C and C++.

There is a long article in the Wikipeda explaining the Compatibility of C and C++.

Also, C is not a subset of C++, according to Bjarne Stroustrup, creator of C++.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
  • Comment on Re^2: Perl6: Choosing language version in the shebang line?

Replies are listed 'Best First'.
Re^3: Perl6: Choosing language version in the shebang line?
by Marshall (Canon) on Feb 23, 2017 at 21:04 UTC
    Alexander, yes you are correct and your post++ is more precise than mine. I updated my post. My word choice of "superset" is wrong. I know a lot more about C++ than I do about Perl 6, but I believe my basic point about relative similarity between the languages is true. I believe that some basic syntax in Perl 6, perhaps array access is just incompatible with Perl 5. I can write new C code that will work under both compilers (and have done so). I do not think that is possible with Perl5/6.