Raw Pointers VS Smart Pointers, Which One Should Beginners Learn First

Raw Pointers VS Smart Pointers, Which One Should Beginners Learn First

Leader 1 2 16
calendar_today agoschedule1 min read
— Originally published at dev.to

These days, I've been learning C++ and have posted some articles about it. Since I started to learn C++ with raw pointers, I naturally hit some common questions: new/delete, manual memory manage, and so on.C++ Traps That Caught Me Off Guard — A Beginner's Log - Coder Legion

A few days ago, I discussed this topic with some C++ developers. As far as I'm concerned, I believe that raw pointers are fundamental and it's necessary for beginners to build a mental model of RAII and memory management before moving to smart pointers.

On the other hand, some developers think that raw pointers are not a suitable topic for beginners - we have the safer and more modern smart pointers to manage, so why not start with them directly?

Actually, it's up for debate whether beginners should learn these constructs. From my own experience learning C++ through raw pointers, I believe beginners can benefit from a moderate understanding of them.

As for performance, there's no absolute winner. Smart pointers are safer and work well for most scenarios, especially when code maintainability matters. Raw pointers still have their place in performance-critical or low-level contexts. The key is knowing both and choosing wisely.

Which one would you learn first if you are a beginner? And why?

🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

Tuesday Coding Tip 06 - Explicit template instantiation

Jakub Neruda - Apr 7

TypeScript Complexity Has Finally Reached the Point of Total Absurdity

Karol Modelskiverified - Apr 23

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelskiverified - Mar 19

Tuesday Coding Tip 02 - Template with type-specific API

Jakub Neruda - Mar 10

Local-First: The Browser as the Vault

Pocket Portfolio - Apr 20
chevron_left
1.3k Points19 Badges
5Posts
11Comments
3Connections
Tech explorer documenting code journeys.

Related Jobs

View all jobs →

Commenters (This Week)

4 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!