cloakedlearning
  • Member for 5 years, 7 months
  • Last seen more than 4 years ago
Yet another Fibonacci number generator
12 votes

Assuming you're using the current c++ standard, since you don't specify in your question. Prefer stoi to atoi. atoi has issues. Prefer standard int types: std::uint128_t instead of unsigned long long ...

View answer
Producer/consumer problem with four priority levels
3 votes

Encapsulate individual queues There's a lot of identical code shared between your queues, which is an indication to encapsulate them. Since they're stateful, a class is appropriate. class QueueEntry ...

View answer
Helper class for accessing blobs and mmap memory
Accepted answer
2 votes

BlobRef details You should provide a default constructor. safeAccessMemory contains a bug. If you have an empty BlobRef and you call safeAccessMemory(0, 0) you will deference a nullptr (the guard ...

View answer
Template class to demonstrate array manipulation
2 votes

Don't define functions with a leading underscore, those names are reserved by the standard. Don't use (s)rand. Instead use std::mt19937 and std::uniform_int_distribution. For some real depth on the ...

View answer
Quicksort using first element pivot
2 votes

Prefer standard integer types Instead of: using uint = unsigned int; Prefer #include <cstdint> //use the std::uint32_t in code (or whichever width) Don't use namespace std Common advice ...

View answer
C++ thread safe queue implementation
1 votes

You should provide an overload of Enqueue that takes an rvalue reference: void Enqueue(T&& item) { std::unique_lock<std::mutex> lock(_queue_mutex); bool was_empty = _queue.empty(...

View answer
How to refactor member function that only differs in string printed
0 votes

This isn't really the correct site to ask about incomplete code. Nonetheless, here's an approach you can take. bool CommandManager::ValidateCommand(const char* command, int set_type) const { if (!...

View answer
Simple ini file parser
0 votes

I hope it's not poor form to review my own code, but here are some thoughts I had on this sample after looking back on it after a couple of days: Work on ifstreams, not paths This class does too ...

View answer