String Literal Conversion to String: Is It a Disaster?

A reader asks,   Sender: Jackre: String Literals are now a Trivial Conversion to StringWon’t it break most of existing libraries who will try to port to C++/CLI? One override for String^ will break a lot of user code and make calls for the overriden function with string literals look much uglier. Maybe it is…

0

String Literals are now a Trivial Conversion to String

  There was a recent internal thread on the resolution of the following set of overloaded member functions of a reference class R. It represents a change in the earlier definition of C++/CLI, and a difference in type behavior that I reported in an earlier blog, and so I believe it is worth discussing. Here…

6

Factor, Don’t Complicate

A reader asks the following question,   Sender: bv   re: A Question about Copy Constructors in C++/CLI   Ok, i have a question. What happens if: suppose you want to make a shallow copy. Ex:   ClassX obj(somePtr);//internally obj.m_ptr = SomePtr;   Now   ClassX obj2(obj);   What problems can occur in such cases?…

7

Putting C++ and the CLI in Perspective

A surprising thread that has emerged has to do with libraries. Here is an representative example,   Sender: Dobes =====================================   re: Towards a Natural Theory of Programming Languages   I also think that the survival of a language is also more an issue of libraries than of language.    I prefer Java because it…

6

System::String -> std::string

A reader asks,   Sender: Erik Brendengen   Is there an easy way to convert from String^ to std::string?              Does String ^s = std::string( “bla”).c_str(); work the other way?   This is a FAQ, one that I myself bumped into when I had to pass a System::String retrieved from System::Windows::Forms::TextBox to a native program…

8

A Question of Interopt

A reader asks the following question,   Sender: Richard Hsu Stan,   Would you suggest, for those of us who are yet to begin learning MC++, to wait till C++/CLI ships, because we’ll not only be learning what will be obsolete syntax, but also a more difficult one.   So, would you recommend, till the…

1

A Reader Bleakly Asks About the Future of C++ within Microsoft

A reader writes   Sender: Brian Braatz ===================================== I posted the following to the boost email group and receieved the following response. I was wondering if you had any comments or thoughts on this. I am personally concerned that MS will eventually ditch C++ or take away my ability to use ALL the features of…

13

C++/CLI: System::String^, std::string, and “a string literal”

Without thinking too hard I had held the following precept: std::string is to ISO C++ as System::String^ is to C++/CLI. Or, to give the idea a political tint, I thought of the two string abstractions as separate but equal library class types. Therefore, I presumed the following pair of overloaded methods was inherently ambiguous,  …

5

Yes, Value Types Have No Destructors

A reader comments   Sender: Joe Pacheco =====================================   re: Integrating Dispose and Finalize into the Language   What about destructors for value classes?  Was it considered when you did the language design?   To become truly usable they are still missing couple of things, copy constructors being one of them.  It’s possible that it…

4

Integrating Dispose and Finalize into the Language

A reader comments   re: Changes in Destructor Semantics in Support of Deterministic Finalization   I agree with Johan.   I use a pattern where all classes that need a finalizer must implement the Dispose pattern, and all classes with a Dipose method also have a finalizer; if you have one you must have the…

4