C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Standard Versus Non-Standard C++
Goto page 1, 2, 3, 4  Next
 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Le Chaud Lapin
Guest





PostPosted: Sun Jul 01, 2012 7:12 am    Post subject: Standard Versus Non-Standard C++ Reply with quote



{ Reformatted; please limit your lines to 70 characters -mod }

Hi All,

I asked a rhetorical question in a recent post, and the post was
rejected, perhaps because I did not explain why I was asking the
question. The question was:

"Is this valid C++ code or not?"

"this" was code like:

// Is this C++?
SyndicationClient^ client = ref new SyndicationClient();
for(wstring url : urls)
// Perhaps it is, and my compiler is simply out of compliance.

....found on this page:

http://msdn.microsoft.com/en-us/library/windows/apps/hh465045.aspx

The Moderator pointed out that it was obviously not.

I asked the question because I believe that Microsoft is being
somewhat untruthful when they persist in calling C++/CX or C++/CLI or
C++/whatever "C++".

It is not. And it is harmful to the integrity of C++ to do so, IMHO.

If it were C++, I would be able to compile it with my
highly-accommodating C++ compiler.

Microsoft has been, for years, attempting to mislead C++ programmers
into thinking that their "variants" of C++ is essentially C++ with a
bit of flavoring. Experienced programmers know better, but it causes
me some dismay to think of all the young programmers who are just
starting out with "Hello World" being told that highly non-standard
extensions are C++. Aside from the non-standard syntax, which, alone
would break any compliant C++ compiler, they use keywords like:

1. sealed
2. ref
3. get

Scattered across the Internet are statements like:

"You're still coding in C++, and you can access the STL, the CRT, and
any other C++ libraries, except that you can't invoke certain
functions directly, such as those related to file I/O."

If you use those three keywords in your code, you are ~not~ coding in
C++. You're coding in something else that just so happens to share a
lot of keywords and syntax with C++.

A few years ago, in this very group, I castigated a Microsoft writer
for naming his MSDN article "Pure C++", when it was anything but, and
he relented, but Microsoft persists with this inaccuracy everywhere.

Experienced coders like those who lurk here know better, and for that
reason, we have a responsibility to make sure young coders are not
corrupted by misrepresentations before they even get started.


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Zeljko Vrba
Guest





PostPosted: Sun Jul 01, 2012 12:15 pm    Post subject: Re: Standard Versus Non-Standard C++ Reply with quote



{ Please avoid useless quotes, but do provide the minimum
necessary to establish context -mod }

On 2012-07-01, Le Chaud Lapin <jaibuduvin (AT) gmail (DOT) com> wrote:
Quote:
{ Reformatted; please limit your lines to 70 characters -mod }

Hi All,

Hi,


I'm not sure what intention you had behind this post. In the
introduction, under "Objectives" it says explicitly that it uses
extended C++ named C++/CX, and this is repeated few times on the
same page.

Your objection is like castigating somebody for saying they speak
"English" instead of "British English" or "English as a second
language".

Also, a question for you: many C++ projects can be compiled with MSVC
and GCC, i.e., they are syntactically correct ISO C++ programs. Yet,
they rely on behavior that is UB according to the standard, but which
both compilers define in a useful way. Since code exhibiting UB at
run-time is technically not "valid C++ code", should the authors of
such projects be allowed to say that they are coding in C++?

When criticizing somebody for saying "C++" when they actually mean
"C++ as compiled by compilers X,Y on platforms A,B,C", why do you
(arbitrarily) draw the line at minor syntax extensions, use of which
is fully avoidable [at the cost of more complexity/verbosity]?

(I agree that syntax extensions are easiest to spot, but that, IMO,
does not make such programs any more "un-C++" than syntactically
correct C++ programs relying on vendor extensions.)


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Martin B.
Guest





PostPosted: Sun Jul 01, 2012 12:33 pm    Post subject: Re: Standard Versus Non-Standard C++ Reply with quote



{ Article accepted because it discusses the relationship between
standard C++ and one of its dialects. Articles only pertaining
to a specific dialect will be rejected as off topic. -mod }

On 01.07.2012 09:12, Le Chaud Lapin wrote:
Quote:
{ Reformatted; please limit your lines to 70 characters -mod }

Hi All,

I asked a rhetorical question in a recent post, and the post was
rejected, perhaps because I did not explain why I was asking the
question. The question was:

"Is this valid C++ code or not?"

"this" was code like:

// Is this C++?
SyndicationClient^ client = ref new SyndicationClient();
for(wstring url : urls)
// Perhaps it is, and my compiler is simply out of compliance.

....found on this page:

http://msdn.microsoft.com/en-us/library/windows/apps/hh465045.aspx

The ref new thing of WinRT is one of those extension I don't really
get. As far as I understand it encapsulates COM reference counting
with IInspectable and (without much thinking and trial on my side,
admitted) it should have been very trivial to do this in purely
standard C++ without a loss in usability.

But then again -- I don't see it matter much because if you're coding
to the WinRT API, it really doesn't matter whether it's standard C++
or not, because you're locked into the MS platform anyway.

Quote:
I asked the question because I believe that Microsoft is being
somewhat untruthful when they persist in calling C++/CX or C++/CLI or
C++/whatever "C++".

It is not. And it is harmful to the integrity of C++ to do so, IMHO.

If it were C++, I would be able to compile it with my
highly-accommodating C++ compiler.

Microsoft has been, for years, attempting to mislead C++ programmers
into thinking that their "variants" of C++ is essentially C++ with a
bit of flavoring. ...

IMHO this is just hair splitting. It's C++ with extensions, what else
would you call it?

At least with CX you don't pull the baggage of the dotnet-runtime into
your process as you do with CLI.

I also fail to see inhowfar this (WinRT/CX) is harmful to C++.

It certainly makes some sense if C++ -- even a variant C++/CX -- is a
1st class citizen on the largest OS platform than if pure C++ would be
a 2nd class citizen on this platform. (But see my first paragraph that
I'm not sure that they couldn't have pulled it off purely with C++11.)

cheers,
Martin

--
Good C++ code is better than good C code, but
bad C++ can be much, much worse than bad C code.



[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Francis Glassborow
Guest





PostPosted: Sun Jul 01, 2012 12:53 pm    Post subject: Re: Standard Versus Non-Standard C++ Reply with quote

On 01/07/2012 08:12, Le Chaud Lapin wrote:
Quote:
{ Reformatted; please limit your lines to 70 characters -mod }

Hi All,

I asked a rhetorical question in a recent post, and the post was
rejected, perhaps because I did not explain why I was asking the
question. The question was:

"Is this valid C++ code or not?"

The answer rather depends on the meaning of 'valid C++ code'
It certainly is not portable code but an implementer is allowed to
provide extensions as long as they issue a diagnostic the first time an
extension is used in a translation unit.

Strictly speaking the diagnostic could be a message of thanks for using
their extensions.

Quote:

"this" was code like:

// Is this C++?
SyndicationClient^ client = ref new SyndicationClient();
for(wstring url : urls)
// Perhaps it is, and my compiler is simply out of compliance.

No an implementation is only required to compile code that is
well-formed according to the standard which that code clearly is not.
However it is not forbidden from accepting such code providing a
diagnostic has been issued at least once per TU.
Quote:

...found on this page:

http://msdn.microsoft.com/en-us/library/windows/apps/hh465045.aspx

The Moderator pointed out that it was obviously not.

I asked the question because I believe that Microsoft is being
somewhat untruthful when they persist in calling C++/CX or C++/CLI or
C++/whatever "C++".

It is not. And it is harmful to the integrity of C++ to do so, IMHO.

Does the implementation compile conforming C++? Yes, so it is an
implementation of C++. However the code itself is not pure C++.

G++ also has non-conforming modes in which it supports various
extensions. That code using those extensions is also often just
presented as C++, which is more confusing for the novice because there
is no upfront extension to the name (OK the implementation is called G++
but it is presented as a C++ implementation).

Almost every existing implementation has support for some extensions.
What sets Microsoft apart is that it actually gives a specific name to
its extended C++. At least in theory using that name to describe code
using the extensions should help inexperienced programmers.

Where MS caused great difficulty in the past was in getting support for
its extensions so interwoven with the basic language that genuine fully
conforming C++ code would fail to compile.

Quote:

If it were C++, I would be able to compile it with my
highly-accommodating C++ compiler.

Microsoft has been, for years, attempting to mislead C++ programmers
into thinking that their "variants" of C++ is essentially C++ with a
bit of flavoring. Experienced programmers know better, but it causes
me some dismay to think of all the young programmers who are just
starting out with "Hello World" being told that highly non-standard
extensions are C++. Aside from the non-standard syntax, which, alone
would break any compliant C++ compiler, they use keywords like:

1. sealed
2. ref
3. get

Scattered across the Internet are statements like:

"You're still coding in C++, and you can access the STL, the CRT, and
any other C++ libraries, except that you can't invoke certain
functions directly, such as those related to file I/O."

If you use those three keywords in your code, you are ~not~ coding in
C++. You're coding in something else that just so happens to share a
lot of keywords and syntax with C++.

Sorry, but I disagree. You are programming in an extended C++.

Quote:

A few years ago, in this very group, I castigated a Microsoft writer
for naming his MSDN article "Pure C++", when it was anything but, and
he relented, but Microsoft persists with this inaccuracy everywhere.

You really need to keep a clear distinction between marketing hype and
those actually responsible for the product. It is the former in cahoots
with some text churning authors who are responsible for the
miss-information. But that has been around for a couple of decades as
using C++ for windows rather than for a console resulted in use of
extensions.



Quote:

Experienced coders like those who lurk here know better, and for that
reason, we have a responsibility to make sure young coders are not
corrupted by misrepresentations before they even get started.



Well perhaps, but it is the responsibility of the wider community to
continue to draw attention to the disservice provided by some writers
who insist on writing about dialects of C++ without making it clear
(probably because they do not know that it is a dialect)




--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
DeMarcus
Guest





PostPosted: Sun Jul 01, 2012 10:04 pm    Post subject: Re: Standard Versus Non-Standard C++ Reply with quote

Quote:
I asked the question because I believe that Microsoft is being
somewhat untruthful when they persist in calling C++/CX or C++/CLI or
C++/whatever "C++".

It is not. And it is harmful to the integrity of C++ to do so, IMHO.

If it were C++, I would be able to compile it with my
highly-accommodating C++ compiler.

Microsoft has been, for years, attempting to mislead C++ programmers
into thinking that their "variants" of C++ is essentially C++ with a
bit of flavoring. ...

IMHO this is just hair splitting. It's C++ with extensions, what else
would you call it?


I guess the problem isn't that Microsoft supports C++ with extensions, the problem is that you can't compile portable code for the Microsoft platform because they have flavored their C++ with various mandatory unstandardized extensions like ___stdcall.

Hopefully all future C++ extensions will be optional on all platforms, otherwise the portability of C++ will be gone.


Regards,
Daniel




--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Le Chaud Lapin
Guest





PostPosted: Sun Jul 01, 2012 10:05 pm    Post subject: Re: Standard Versus Non-Standard C++ Reply with quote

On Sunday, July 1, 2012 7:53:37 AM UTC-5, Francis Glassborow wrote:
Quote:
On 01/07/2012 08:12, Le Chaud Lapin wrote:
Microsoft has been, for years, attempting to mislead C++ programmers
into thinking that their "variants" of C++ is essentially C++ with a
bit of flavoring. Experienced programmers know better, but it causes
me some dismay to think of all the young programmers who are just
starting out with "Hello World" being told that highly non-standard
extensions are C++. Aside from the non-standard syntax, which, alone
would break any compliant C++ compiler, they use keywords like:

1. sealed
2. ref
3. get

Scattered across the Internet are statements like:

"You're still coding in C++, and you can access the STL, the CRT, and
any other C++ libraries, except that you can't invoke certain
functions directly, such as those related to file I/O."

If you use those three keywords in your code, you are ~not~ coding in
C++. You're coding in something else that just so happens to share a
lot of keywords and syntax with C++.

Sorry, but I disagree. You are programming in an extended C++.

I am responding to Francis [since I like Francis Smile], but please
take this response as a response to all replies to my OP so far,
as they all share similar rebuttals to my argument.

As several have pointed out, there are numerous C++ compilers that
provide their own extensions. These, I have no problem with, because
they generally:

1. Add a feature that is not present in C++ proper.
2. Allow tweaking of feature that is present in C++ proper.

C++/CLI actually changes the meaning of existing C++ keywords sometimes.

To continue with the analogy regarding US English vs British
English, naturally, there are many words that are not shared
in everyday English between the two. Some words have different
meanings depending on which context. But the differences are not
so large so as to make prose written in one dialect unreadable by
someone not familiar with that dialect. I have no problem reading
British or Australian English, but if the grammatical structure
were changed to force use of the the various cases of, say,
Swedish, I would have trouble.

I have no problem reading C++ code that uses Microsoft COM extension
keywords. I have enormous problems reading the so-called C++/CLI.
I have no idea what the '^' character means in that context,
and I have no intention of learning, unless, of course, their
extensions become standardized by ISO, as a variant of C++,
in which case I will learn it. But therein lies the problem. They
are not extensions, but fundamental changes to the language.

UK representation of ISO pointed this out entitling one of their
sections of an objection letter:

"IV. A new language needs a new name "

....and also by writing:

"The UK request that Ecma withdraw this document from
fast-track voting and if they must re-submit it to JTC1,
do so under a name which does not include “C++”.

See:

http://www2.research.att.com/~bs/uk-objections.pdf

-Le Chaud Lapin-


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Edward Diener
Guest





PostPosted: Mon Jul 02, 2012 6:03 am    Post subject: Re: Standard Versus Non-Standard C++ Reply with quote

On 7/1/2012 6:05 PM, Le Chaud Lapin wrote:
Quote:
On Sunday, July 1, 2012 7:53:37 AM UTC-5, Francis Glassborow wrote:
On 01/07/2012 08:12, Le Chaud Lapin wrote:
Microsoft has been, for years, attempting to mislead C++ programmers
into thinking that their "variants" of C++ is essentially C++ with a
bit of flavoring. Experienced programmers know better, but it causes
me some dismay to think of all the young programmers who are just
starting out with "Hello World" being told that highly non-standard
extensions are C++. Aside from the non-standard syntax, which, alone
would break any compliant C++ compiler, they use keywords like:

1. sealed
2. ref
3. get

Scattered across the Internet are statements like:

"You're still coding in C++, and you can access the STL, the CRT, and
any other C++ libraries, except that you can't invoke certain
functions directly, such as those related to file I/O."

If you use those three keywords in your code, you are ~not~ coding in
C++. You're coding in something else that just so happens to share a
lot of keywords and syntax with C++.

Sorry, but I disagree. You are programming in an extended C++.

I am responding to Francis [since I like Francis Smile], but please
take this response as a response to all replies to my OP so far,
as they all share similar rebuttals to my argument.

As several have pointed out, there are numerous C++ compilers that
provide their own extensions. These, I have no problem with, because
they generally:

1. Add a feature that is not present in C++ proper.
2. Allow tweaking of feature that is present in C++ proper.

C++/CLI actually changes the meaning of existing C++ keywords sometimes.

Please give an example that supports your assertion.

Quote:

To continue with the analogy regarding US English vs British
English, naturally, there are many words that are not shared
in everyday English between the two. Some words have different
meanings depending on which context. But the differences are not
so large so as to make prose written in one dialect unreadable by
someone not familiar with that dialect. I have no problem reading
British or Australian English, but if the grammatical structure
were changed to force use of the the various cases of, say,
Swedish, I would have trouble.

I have no problem reading C++ code that uses Microsoft COM extension
keywords. I have enormous problems reading the so-called C++/CLI.
I have no idea what the '^' character means in that context,
and I have no intention of learning, unless, of course, their
extensions become standardized by ISO, as a variant of C++,
in which case I will learn it. But therein lies the problem. They
are not extensions, but fundamental changes to the language.

Microsoft makes it very plain that C++/CLI is a language extension to
C++ which allows programmers to program the .Net framework using a C++
dialect. It is clearly not standard C++, nor does it intend to be. I
cannot believe that anybody really professional using it does not know
almost immediately that it is not standard C++.

My disagreement with Microsoft is not that C++/CLI is not C++ but that
Microsoft originally inferred that it was to be a first-class .Net
language, like C#, but never carried out that promise.

Borland created C++ Builder, which is also an extension to C++, well
before Microsoft crreated C++/CLI. I do not recall an outcry about C++
Builder not being standard C++ from anybody.

I do not agree that your complaint against Microsoft is a valid one in
regards to labelling C++/CLI as C++.


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Robert Wessel
Guest





PostPosted: Mon Jul 02, 2012 1:21 pm    Post subject: Re: Standard Versus Non-Standard C++ Reply with quote

On Sun, 1 Jul 2012 15:04:21 -0700 (PDT), DeMarcus
<use_my_alias_here (AT) hotmail (DOT) com> wrote:

Quote:
I asked the question because I believe that Microsoft is being
somewhat untruthful when they persist in calling C++/CX or C++/CLI
or C++/whatever "C++".

It is not. And it is harmful to the integrity of C++ to do so,
IMHO.

If it were C++, I would be able to compile it with my
highly-accommodating C++ compiler.

Microsoft has been, for years, attempting to mislead C++
programmers into thinking that their "variants" of C++ is
essentially C++ with a bit of flavoring. ...

IMHO this is just hair splitting. It's C++ with extensions, what
else would you call it?

I guess the problem isn't that Microsoft supports C++ with
extensions, the problem is that you can't compile portable code for
the Microsoft platform because they have flavored their C++ with
various mandatory unstandardized extensions like ___stdcall.

Hopefully all future C++ extensions will be optional on all
platforms, otherwise the portability of C++ will be gone.

MS's C++ implementation is pretty good, standards wise. Sure they
have non-standard extensions, but so does everyone else. They also
have a couple of languages, C++/CX, C++/CLI, which are less
straight-forward extensions of C++. But if you were porting a C++
program, you'd probably want to stick to the standard C++ dialect (not
that the port to the other dialects would usually be all that
difficult, but almost certainly more work than the straight C++ port).

And the need for __stdcall in Windows is not really different than the
need for __attribute__((stdcall)) in GCC - mainly you need to use it
when building interfaces to shared/system libraries (DLLs) (which is
not covered by the standard anyway).


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Le Chaud Lapin
Guest





PostPosted: Mon Jul 02, 2012 1:41 pm    Post subject: Re: Standard Versus Non-Standard C++ Reply with quote

On Sunday, July 1, 2012 7:15:45 AM UTC-5, Zeljko Vrba wrote:
Quote:
{ Please avoid useless quotes, but do provide the minimum
necessary to establish context -mod }
On 2012-07-01, Le Chaud Lapin wrote:

Also, a question for you: many C++ projects can be compiled with
MSVC and GCC, i.e., they are syntactically correct ISO C++ programs.
Yet, they rely on behavior that is UB according to the standard, but
which both compilers define in a useful way. Since code exhibiting
UB at run-time is technically not "valid C++ code", should the
authors of such projects be allowed to say that they are coding in
C++?

Because such UB code would be, in fact, valid C++. About this code,
the standard would say: "This code is will be compiled by a conforming
compiler, but the behavior would be undefined.

Quote:
When criticizing somebody for saying "C++" when they actually mean
"C++ as compiled by compilers X,Y on platforms A,B,C", why do you
(arbitrarily) draw the line at minor syntax extensions, use of which
is fully avoidable [at the cost of more complexity/verbosity]?

Because the extensions are not minor. In some cases, they are
wholesale replacements for concepts that C++ already offers.

To play devil's advocate, one could argue that in my own programming,
I contradict my argument: I never use STL, ever. I never use set<>,
list<>, vector<>, or string. But I do use Set<>, List<>, Vector<>, and
String, and I claim that my new classes are "C++. There are two
reasons that I can legitimately make this claim.

1. An ISO-compliant compiler will compile my code.
2. If I were an instructor teaching C++ to beginners, and my students
were aware of the existence of a standard library that included
things like set<>, vector<>, list<>, etc...I would tell them that
the classes that I am recommending that they use: Set<>, List<>,
Vector<>, String; are not the classes that they heard about from
the standard library, even though the names are the similar, and I
would issue copious warnings that they should not expect such code
to run anywhere my library binary code does not exist, which is
pretty much everywhere.
I would not tell them when they employ my library, "You are still
programming in the standard library." This is what is sometimes
stated by Microsoft when Microsoft uses non-standard extensions
like "^". They say, "It is still C++.", and it looks like C++,
because the keywords are the same, but the semantics of those
keywords have been changed in subtle ways. Here is what they did
to 'const' and 'volatile':

"The semantics of const and volatile are changed. const (frequently
used in C++ code) is only an optional modifier (modopt) in the CLI
bindings, and therefore can be ignored by compilers and other
tools, whereas volatile (rarely used in C++ code) is a required
modifier (modreq)."

See:

http://www2.research.att.com/~bs/uk-objections.pdf


-Le Chaud Lapin-


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Le Chaud Lapin
Guest





PostPosted: Mon Jul 02, 2012 1:43 pm    Post subject: Re: Standard Versus Non-Standard C++ Reply with quote

On Sunday, July 1, 2012 7:33:18 AM UTC-5, Martin B. wrote:
Quote:
On 01.07.2012 09:12, Le Chaud Lapin wrote:
Microsoft has been, for years, attempting to mislead C++
programmers into thinking that their "variants" of C++ is
essentially C++ with a bit of flavoring. ...

IMHO this is just hair splitting. It's C++ with extensions, what
else would you call it?

The UK representation of ISO C++ offered the following
suggestions for names to Microsoft:

*** In a spirit of helpful cooperation we even offer a few suggestions
on possible new names: CLIpp or CliPP, CLI++ (the emphasis is on
powerful access to CLI and more, since it supports unmanaged code
too), or ++CLI (ditto, and also note that it contains "C++" spelled
backwards), Ceeli (though this may conflict with an old ICL language
for its mainframes), or even eCma++ (an obvious sister language to
Ecmascript). ***

See penultimate paragraph of:
http://www2.research.att.com/~bs/uk-objections.pdf

-Le Chaud Lapin-


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Dave Harris
Guest





PostPosted: Mon Jul 02, 2012 1:53 pm    Post subject: Re: Standard Versus Non-Standard C++ Reply with quote

jaibuduvin (AT) gmail (DOT) com (Le Chaud Lapin) wrote (abridged):
Quote:
// Is this C++?
SyndicationClient^ client = ref new SyndicationClient();
for(wstring url : urls)
// Perhaps it is, and my compiler is simply out of compliance.

The for-loop is C++. That syntax is one of the improvements in C++11.
The other line is not standard C++.

Quote:
Aside from the non-standard syntax, which, alone would break any
compliant C++ compiler, ...

You say that as if it were a bad thing. It's actually key to being a
legitimate C++ extension. The standard says:

A conforming implementation may have extensions (including
additional library functions), provided they do not alter the
behavior of any well-formed program. Implementations are required
to diagnose programs that use such extensions that are ill-formed
according to this Standard. Having done so, however, they can
compile and execute such programs.

So a requirement for Microsoft was that every C++/CX program that also
conforms to standard C++ syntax, have the same semantics as the
corresponding C++ program, and all the new behaviour be triggered by
new syntax.

-- Dave Harris, Nottingham, UK.


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Martin B.
Guest





PostPosted: Mon Jul 02, 2012 2:00 pm    Post subject: Re: Standard Versus Non-Standard C++ Reply with quote

On 02.07.2012 00:04, DeMarcus wrote:
Quote:
I asked the question because I believe that Microsoft is being
somewhat untruthful when they persist in calling C++/CX or C++/CLI
or C++/whatever "C++".

It is not. And it is harmful to the integrity of C++ to do so,
IMHO.

If it were C++, I would be able to compile it with my
highly-accommodating C++ compiler.

Microsoft has been, for years, attempting to mislead C++
programmers into thinking that their "variants" of C++ is
essentially C++ with a bit of flavoring. ...

IMHO this is just hair splitting. It's C++ with extensions, what
else would you call it?

I guess the problem isn't that Microsoft supports C++ with
extensions, the problem is that you can't compile portable code for
the Microsoft platform because they have flavored their C++ with
various mandatory unstandardized extensions like ___stdcall.

Huh??

stdcall is a calling convention for functions and I fail to see both
inhowfar this annotation is mandatory(??!) and how it inhibits
compilation of standard compliant code?

Care to give an non-contrieved example of standard C++ (03 or 11 as
far as implemented) code that won't compile with VC?

(Yes, I am aware that there are situations where MSVC isn't fully
standard compliant - but that doesn't imply "you can't compile
portable code".)

cheers,
Martin


--
Good C++ code is better than good C code, but
bad C++ can be much, much worse than bad C code.



[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Dave Harris
Guest





PostPosted: Mon Jul 02, 2012 2:03 pm    Post subject: Re: Standard Versus Non-Standard C++ Reply with quote

eldiener (AT) tropicsoft (DOT) invalid (Edward Diener) wrote (abridged):
Quote:
My disagreement with Microsoft is not that C++/CLI is not C++ but
that Microsoft originally inferred that it was to be a first-class
.Net language, like C#, but never carried out that promise.

Note that C++/CLI and C++/CX are different things. C++ is about
zero-overhead abstractions, and arguably C++/CLI failed because it
compiled to the .NET byte-code platform which is intrinsically
incapable of delivering that.

C++/CX, on the other hand, compiles to native code, and does deliver
zero-overhead abstractions. The original post was about C++/CX.

-- Dave Harris, Nottingham, UK.


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Chris Uzdavinis
Guest





PostPosted: Mon Jul 02, 2012 6:05 pm    Post subject: Re: Standard Versus Non-Standard C++ Reply with quote

On Monday, July 2, 2012 8:41:01 AM UTC-5, Le Chaud Lapin wrote:
....

Quote:
Because such UB code would be, in fact, valid C++. About this code,
the standard would say: "This code is will be compiled by a
conforming compiler, but the behavior would be undefined.

Undefined behavior is syntactically valid C++, but not semantically.
To me it does seem a bit arbitrary to draw the line of distinction
between language extensions and undefined behavior.

Semantic difference is usually much, much more difficult to debug and
understand, as opposed to funny-looing annotations or keywords in the
language. And it has usually been better (for me at least) to see a
compile-time error rather than runtime errors, so I'd prefer to run
into code with extensions rather than undefined-behavior dependencies.

(Not that it's fun to fix either...)

Quote:
Because the extensions are not minor. In some cases, they are
wholesale replacements for concepts that C++ already offers.

Sometimes they're not replacements, but simply new features. Like,
say, g++'s ability to take the address of labels and do computed
gotos. Very, very nice feature, but non-standard. Is it bad?

Quote:
To play devil's advocate, one could argue that in my own programming,
I contradict my argument: I never use STL, ever. I never use set<>,
list<>, vector<>, or string. But I do use Set<>, List<>, Vector<>, and
String, and I claim that my new classes are "C++. There are two
reasons that I can legitimately make this claim.

1. An ISO-compliant compiler will compile my code.

Ok.

Quote:
2. If I were an instructor teaching C++ to beginners, and my students
were aware of the existence of a standard library that included
things like set<>, vector<>, list<>, etc...I would tell them that
the classes that I am recommending that they use: Set<>, List<>,
Vector<>, String; are not the classes that they heard about from
the standard library, even though the names are the similar, and I
would issue copious warnings that they should not expect such code
to run anywhere my library binary code does not exist, which is
pretty much everywhere.

When it comes to instruction, I do side with your purist attitude.
I'm a former purist, now just "mostly purist except when other things
are more important." People should know what is pure C++ and know
what are extensions, and probably should learn the langauge properly
before going into implementation-specific areas. That said, there is
NOTHING wrong with implementation-specific features in a compiler if
it makes your code better or easier or faster or (whatever), compared
to code not using that extention.

Knowing the tradeoffs, I have no qualms about using non-portable java
interfaces either, even though it's virtually taboo to say that
online.

Quote:
I would not tell them when they employ my library, "You are still
programming in the standard library." This is what is sometimes

Correct, that would be lying.

Quote:
stated by Microsoft when Microsoft uses non-standard extensions
like "^". They say, "It is still C++.", and it looks like C++,

Would you be happier if they said it was a C++ "environment"?

Quote:
because the keywords are the same, but the semantics of those
keywords have been changed in subtle ways. Here is what they did
to 'const' and 'volatile':

"The semantics of const and volatile are changed. const (frequently
used in C++ code) is only an optional modifier (modopt) in the CLI
bindings, and therefore can be ignored by compilers and other
tools, whereas volatile (rarely used in C++ code) is a required
modifier (modreq)."

But nothing forces you to use their CLI bindings, right?


Chris


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Francis Glassborow
Guest





PostPosted: Mon Jul 02, 2012 6:06 pm    Post subject: Re: Standard Versus Non-Standard C++ Reply with quote

On 02/07/2012 14:43, Le Chaud Lapin wrote:
Quote:
On Sunday, July 1, 2012 7:33:18 AM UTC-5, Martin B. wrote:
On 01.07.2012 09:12, Le Chaud Lapin wrote:
Microsoft has been, for years, attempting to mislead C++
programmers into thinking that their "variants" of C++ is
essentially C++ with a bit of flavoring. ...

IMHO this is just hair splitting. It's C++ with extensions, what
else would you call it?

The UK representation of ISO C++ offered the following
suggestions for names to Microsoft:

*** In a spirit of helpful cooperation we even offer a few suggestions
on possible new names: CLIpp or CliPP, CLI++ (the emphasis is on
powerful access to CLI and more, since it supports unmanaged code
too), or ++CLI (ditto, and also note that it contains "C++" spelled
backwards), Ceeli (though this may conflict with an old ICL language
for its mainframes), or even eCma++ (an obvious sister language to
Ecmascript). ***


However you need to get the context correct. The UK was objecting to
C++/CLI becoming and ISO Standard. I think we would have objected to
Borland's C++ Builder becoming a Standard as well. The later was, IME,
much harder to use without all its extensions. Over the last decade I
cannot recall any time where I had a problem getting my C++ code to
compile with Visual C++. The last time I had a problem was when they had
failed to implement the alternative operator keywords (and, xor etc.).
Even that was immediately visible when using colour coded syntax so it
was no more than an irritation and was quickly corrected when I had
cornered one of their implementers at a conference to draw attention to
the failing.

On the positive side, over the last decade MS have made considerable
efforts to track the development of C++0x. They contributed a great deal
of helpful insights and expertise (but that was the implementation side
of MS not its marketing department)


Francis


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
 


Powered by phpBB © 2001, 2006 phpBB Group