• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Do I need to know pointers to program in C++?

 
Rogerio Kioshi
Ranch Hand
Posts: 690
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is it necessary to know pointers and how to manage memory allocation to program in C++?

If it is, I prefer programming in Java...
 
Henry Wong
author
Marshal
Pie
Posts: 21515
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No offense, but if you don't know whether C++ has pointers or not, how do you know enough about both languages to make a decision on what you prefer or not?

Henry


PS... I will take this topic as a serious and valid inquiry. Because we don't like topics that try to start a language war, during a book promotion, when we have special guests visiting.
 
Prentiss Knowlton
Author
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good afternoon, Rogerio --

You don't need to know pointers to manage memory. The gcnew operator in C++ 2008 is the counterpart to the new operator in Java. The only visible difference in C++ 2008 is that you use explicit ^ notation to specify reference variables initialized with gcnew.

For example,

Otherwise you work with reference data in much the same way as you work with it in Java.

Additional notational patterns in C++ .NET explicitly has you document the nature of each of your programming elements (e.g., object, class, reference element, value element). This better reveals the inner workings of your code and helps you and and other programmers working with you make better efficiency and design trade-offs. The book is full of ample examples to make these code patterns easy to understand and comfortable to work with.

Like Java, reference elements created with gcnew are automatically deleted when they are no longer needed.

In addition to this Java compatibility of usage, you still have the benefit of access to native C++ and legacy C pointers along with backward compatible operation of the native C++ new and delete keywords covering the 40+ years of C, native C++, and C++.NET language syntax evolution as discussed in chapter 19.

Best regards,
Prentiss


Rogerio Kioshi wrote:Hi,

Is it necessary to know pointers and how to manage memory allocation to program in C++?

If it is, I prefer programming in Java...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic