aspose file tools*
The moose likes C / C++ and the fly likes Do I need to know pointers to program in C++? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Languages » C / C++
Bookmark "Do I need to know pointers to program in C++? " Watch "Do I need to know pointers to program in C++? " New topic
Author

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

Rogerio Kioshi
Ranch Hand

Joined: Apr 12, 2005
Posts: 689
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...


SCEA 5 (part 1), SCBCD, SCWCD, SCJP, CLP, CLS
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

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.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Prentiss Knowlton
Author
Greenhorn

Joined: Dec 18, 2009
Posts: 7
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...


Prentiss Knowlton

People don't care how much you know until they know how much you care -- Cavett Robert
 
Don't get me started about those stupid light bulbs.
 
subject: Do I need to know pointers to program in C++?