Error C3699 Indirection Caret

  • Thread starter Thread starter Bob Palank
  • Start date Start date
B

Bob Palank

Given the following from MSVC Help:
// C3699.cpp// compile with: /clr /cusing namespace System;int main() {
String * s; // C3699
// try the following line instead String ^ s2}

So how do we handle such a major change with new C++ students when the
current books show astericks ?
The change to the caret works of course.
But can someone provide an explanation as to why we should use the caret in
words a beginning student can understand ?
I suppose the beginning student would say caret in place of asterick ? -
who cares and would move on.
But I worry about the student who wants an explanation.
How would you explain it ?
TIA Bob
 
Given the following from MSVC Help:
// C3699.cpp// compile with: /clr /cusing namespace System;int main() {
String * s; // C3699
// try the following line instead String ^ s2}

So how do we handle such a major change with new C++ students when the
current books show astericks ?
The change to the caret works of course.
But can someone provide an explanation as to why we should use the caret
in words a beginning student can understand ?
I suppose the beginning student would say caret in place of asterick ? -
who cares and would move on.
But I worry about the student who wants an explanation.
How would you explain it ?

Well, that has been debated some time ago.
microsoft wanted to make a clear distinction between managed code and native
code.
* and & are ANSI C++, ^ and % are C++/CLI which is an extension to enable
..NET programming in C++.

native C++ will still use the normal operators * and &.
if that is what your students use, they don't even have to know about the
managed extensions and new syntax.

You may want to read this:
www.gotw.ca/publications/C++CLIRationale.pdf
It contains an explanation of why some decisions were made with regards to
C++/CLI.
It is written by Herb Sutter, who is the Visual C++ team lead.

--

Kind regards,
Bruno van Dooren
(e-mail address removed)
Remove only "_nos_pam"
 
An excellent reply and thank you.
Bob
Bruno van Dooren said:
Well, that has been debated some time ago.
microsoft wanted to make a clear distinction between managed code and
native code.
* and & are ANSI C++, ^ and % are C++/CLI which is an extension to enable
.NET programming in C++.

native C++ will still use the normal operators * and &.
if that is what your students use, they don't even have to know about the
managed extensions and new syntax.

You may want to read this:
www.gotw.ca/publications/C++CLIRationale.pdf
It contains an explanation of why some decisions were made with regards to
C++/CLI.
It is written by Herb Sutter, who is the Visual C++ team lead.

--

Kind regards,
Bruno van Dooren
(e-mail address removed)
Remove only "_nos_pam"
 
Back
Top