Skip to main content
Code Review

Questions tagged [pointers]

In computer science, a pointer is a programming language data type whose value refers directly to (or "points to") another value stored elsewhere in the computer memory using its address.

Filter by
Sorted by
Tagged with
14 votes
5 answers
2k views

I implemented FFT in C

I wrote Cooley-Tukey's FFT algorithm in C. And I want to know how safe is this code? Is it just trash? How can I make it more memory safe? ...
9 votes
2 answers
859 views

My shared_ptr implementation

I would like to ask for a code review of my shared_ptr<T> implementation for design, code style. Any nitpicks will extremely useful for me. The features ...
10 votes
6 answers
2k views

k-Nearest Neighbors algorithm in C

I've been learning C for a while, and I decided to make a simple kNN program. What can I do to improve the program? Am I doing memory management right? Can the structure of the code be improved in ...
4 votes
1 answer
125 views

Maze game from book Design Patterns with smart pointers and polymorphism

The Design Patterns book chapter 3 about Creational Patterns starts with a maze game. They use the maze as an example throughout the chapter and instead of rooms they have also things like enchanted ...
3 votes
1 answer
124 views

Leveraging EBCO (Empty Base Class Optimization )in a Simplified Smart‐Pointer with Custom Deleters

I’ve been experimenting with a minimal unique_ptr–style class to see Empty Base Class Optimization(EBCO) in action when the deleter is empty: ...
sam's user avatar
sam
  • 379
7 votes
3 answers
1k views

C++ implementation of Go inspired cancellable context

I am trying to create golang inspired cancellable context in C++ for use in worker threads and other tasks. I have tried to avoid using raw pointers, but ever since I started writing C++ code, I ...
4 votes
1 answer
150 views

Compute index in a ring buffer

I have a buffer implemented as a fixed-size std::vector with two begin and end pointers ...
14 votes
2 answers
583 views

Custom implementation of `std::unique_ptr<T>`

I skimmed through the documentation on cppreference.com and put down the basic functionalities expected out of a unique_ptr<T> implementation. I coded up a ...
6 votes
2 answers
792 views

polymorphic message container [closed]

Any comments/suggestions on this design? I just want to hold onto an ordered collection of messages. Each message can be one of several types. I'm using some code analogous to this currently in a ...
Taylor's user avatar
  • 303
5 votes
3 answers
421 views

Implementation of arrays that store their size

In this code I implemented arrays that store their own size before the first element. To access it you need to go back exactly sizeof(size_t) bytes back. To free it,...
3 votes
2 answers
172 views

Todo List app using C

I just learned to deal with pointers and memory allocation stuff. Using that, I built a todo list app, and it works as far as I tested it. I didn't account for many user errors, so any suggestion to ...
5 votes
3 answers
909 views

Safe(r) / Easier Pointer Allocation Interface in C (ISO C11)

I spent like half an hour programming up a set of functions to make the allocation / deallocate of pointers easier within a bigger project. I felt that they were satisfactory, but was wondering if ...
Zenais's user avatar
  • 75
1 vote
1 answer
279 views

A unique_ptr-like class, for spans instead of raw pointers

Introduction / Motivation I like the CADRe (a.k.a. RAII) resource management idiom in C++. And I like std::span's; or perhaps I should say, I dislike the use of ...
3 votes
1 answer
109 views

Compare and merge sets from unstructured variables for automatic differentiation

I have developed an automatic differentiation module for my software. Usually AD comes in two forms; forward mode or reverse mode and very clever approaches, beyond me, might mix both. Typically the ...
Attack68's user avatar
  • 633
4 votes
1 answer
188 views

Trie implementation using std::shared_ptr

I've implemented a basic Trie that is supposed to work only with lowercase English letters. ...
csmathhc's user avatar
  • 143

15 30 50 per page
1
2 3 4 5
...
28

AltStyle によって変換されたページ (->オリジナル) /