Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. Odd, I like C++/CLI but you listed exactly its features I dislike. My criticisms:
  2.  
  3. - > [C++-style references for managed types](http://stackoverflow.com/questions/2181846/how-can-i-get-close-to-non-nullable-types-in-c-today), not as elegant as full blown [non-nullable](http://stackoverflow.com/search?q=non-nullable) references but better than nothing or using a [work-around](http://msmvps.com/blogs/jon_skeet/archive/2008/10/06/non-nullable-reference-types.aspx).
  4.  
  5. Okay. But accidental use of the hat is pretty widespread, getting
  6. the value of the value type boxed without warning. There is no way
  7. to diagnose this mistake.
  8. - > templates which are more powerful than generics
  9.  
  10. Power that comes at a high price, templates you write are not usable
  11. in any other .NET language. If anything, it worsens the C++ template
  12. export problem. The complete failure of STL/CLR is worth pondering
  13. too.
  14. - > preprocessor (this may be a disadvantage!, but macros can be useful for code generation)
  15.  
  16. Erm, no.
  17. - > stack semantics for reference types--automatically calling *IDisposable::Dispose()*
  18.  
  19. This was IMO a serious mistake. It already is difficult to avoid
  20. problems with accidental boxing, as outlined in the first bullet.
  21. Stack semantics makes it seriously difficult for any starting
  22. programmer to sort this out. This was a design decision to placate
  23. C++ programmers, that's okay, but the using statement was a better
  24. solution.
  25. - > easier implementation of *Dispose()* via C++ destructor
  26.  
  27. Not sure how it is easier. The GC.SuppressFinalize() call is
  28. automatic, that's all. It is *very* rare for anybody to write a
  29. finalizer, but you can't avoid the auto-generated code from making
  30. the call. That's inefficient and a violation of the 'you don't pay
  31. for what you don't use' principle. Add to this that writing the
  32. destructor also forces a default finalizer to be auto-generated. One
  33. you'd never use and wouldn't want to be used if you forgot or omitted
  34. to use the destructor.
  35.  
  36. Well, that's all very subjective perhaps. The death-knell will come with VS2010, it will ship without IntelliSense support for C++/CLI.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement