Skip to main content
19 votes

strcat_new() function, not present in standard C library

Neat and well formatted Design Rather than "then after every string, the 'delim' string is concatenated." (that sounds like n delimiters), I would expect ...
chux's user avatar
  • 36.4k
18 votes
Accepted

Min function accepting varying number of arguments in C++17

template <typename Less, typename T, typename... Ts> constexpr const T& min(Less less, const T& a, const T& b, const Ts&... rems) { This ...
Snowhawk's user avatar
  • 6,770
16 votes

2D counterpart of std::array in C++17

Let me collect a couple of thoughts here. Aggregate initialization currently works like this: array2d<int, 2, 2> a{{1, 2, 3, 4}}; but wouldn't it be ...
lubgr's user avatar
  • 956
15 votes

A linked list in C, as generic and modular as possible, for my personal util library

Immediate notes: Casting malloc (as well as realloc and calloc) is not necessary in C. ...
Chris's user avatar
  • 4,409
14 votes
Accepted

Java TreeMap.floorKey() equivalent for std::map

Headers and namespaces The function is missing a definition of map. This is probably what you want: ...
Toby Speight's user avatar
  • 88.3k
12 votes

Min function accepting varying number of arguments in C++17

This looks nice! Two issues I see here, When compiling your template with clang, it refuses the if constexpr dispatch for every ...
lubgr's user avatar
  • 956
12 votes
Accepted

Linked List implementation in c++ with all functions

Using std::shared_ptr to manage your nodes is very heavyweight. I would expect a container to look for efficiency, or provide seriously extended service. ...
Deduplicator's user avatar
  • 19.9k
12 votes

A linked list in C, as generic and modular as possible, for my personal util library

Overview You never use the compare or freeData members of the linked list why are they there? Also it obviously does not compile ...
Loki Astari's user avatar
  • 97.7k
11 votes
Accepted

A library for interacting with JPL Horizons

Use Requests urllib is kind of a pain to use. Use Requests instead. Among other things, all of this code: ...
Reinderien's user avatar
  • 71.1k
10 votes
Accepted

NASM tutorial (Linux syscalls, 64 bit) code with CI-build and test

When the function has finished it's logic, these registers should have their previous values The normal x86-64 System V calling convention allows functions to clobber RAX, RCX, RDX, RSI, RDI, and R8-...
Peter Cordes's user avatar
  • 3,761
10 votes

LinkedList data structure in C

There is a pattern like this that occurs a couple of times: if(p_head_node == NULL) printf("Memory allocation failed."); p_head_node->data = item; ...
user555045's user avatar
  • 12.4k
9 votes

Min function accepting varying number of arguments in C++17

It works well, according to my simple test program: #include <functional> int main() { return min(std::less<int>(), 2, 0, 3); } I suggest that when ...
Toby Speight's user avatar
  • 88.3k
9 votes

Java TreeMap.floorKey() equivalent for std::map

Your code is obviously wrong: template <typename key,typename value> This line suggests that the code works for arbitrary maps, yet you require an ...
Roland Illig's user avatar
  • 21.9k
9 votes

strcat_new() function, not present in standard C library

Reserved identifiers The include-guard _STRCAT_NEW_H_ is one of the names reserved for the implementation, as it begins with underscore and an upper-case letter. As ...
Toby Speight's user avatar
  • 88.3k
9 votes

C++ I wrote a simple and fast formatting library for strings

This library is not the best in general, but for my project needs it is the fastest and the best Did you run any benchmarks? How does it compare against iostream, ...
G. Sliepen's user avatar
  • 69.3k
8 votes
Accepted

MMMRjs a product of BYTES Genesis

Comments The comments such a This is Mean. are pointless. And the comment ...
RoToRa's user avatar
  • 11.6k
8 votes
Accepted

Generic matrix library in Java

Dense matrix multiplication in 15572 ms. Going by the demo code I assume this was the product between two 1000x1000 matrices. By my estimate based on old code the raw operations by themselves could ...
user555045's user avatar
  • 12.4k
8 votes
Accepted

Polynomial.java - A tiny Java library for dealing with polynomials with double coefficients

Polynomial evaluation for (int pow = 0; pow < coefficients.length; pow++) { value += coefficients[pow] * Math.pow(x, pow); } It's fine, it's a naive ...
user555045's user avatar
  • 12.4k
8 votes

Polynomial.java - a Java class for dealing with polynomials with BigDecimal coefficients

Polynomial Broken equals() / hashCode() contract One of the requirements of the general ...
Alexander Ivanchenko's user avatar
8 votes

LinkedList data structure in C

(First: my personal preference is to use considerable more spaces and braces, but I'll keep to your style.) The field index might be nice during development, but ...
Joop Eggen's user avatar
  • 4,656
8 votes

LinkedList data structure in C

Design considerations Linked lists are the wrong choice for indexed / random access. Use a dynamically-allocated array instead if that's an important access mode for you. In fact, consider whether <...
John Bollinger's user avatar
7 votes
Accepted

My little C++ library for comfortable programming

General Observations Can it be done in other way? For example, I can write code in multiple files, but then compile into one .lib file? If so, how to install it then? Generally it is best to put ...
pacmaninbw's user avatar
  • 26.1k
7 votes

C++ I wrote a simple and fast formatting library for strings

DSL design Think about the DSL you want to implement, write its rules down, and then try to find the corner-cases. What should happen if the string in the smart-padding is bigger than the requested ...
Deduplicator's user avatar
  • 19.9k
7 votes

C++ (Cross-Platform) Predefined Library

Design review There are other libraries that do more or less what you’re trying to do, in whole or in part (for example Boost.Config). Even so, I’m skeptical about why most of this stuff would be ...
indi's user avatar
  • 16.5k
7 votes

Arduino library to simplify differential drive robots

General Observations The point of a library is to provide abstraction, reducing the amount of work that the user needs to do to accomplish what they want to do. This library does not provide any ...
pacmaninbw's user avatar
  • 26.1k
7 votes
Accepted

Arduino library to simplify differential drive robots

It's great that you have a library that works for you, but now you should think of redesigning it. I see that class DDBot is implementing the low-level ...
G. Sliepen's user avatar
  • 69.3k
7 votes

A simple unit test library for C

The header doesn't need to include anything except <stddef.h> (to define size_t). These two externs are never used: <...
Toby Speight's user avatar
  • 88.3k
7 votes

Polynomial.java - A tiny Java library for dealing with polynomials with double coefficients

Precision loss Binary floating point numbers due to their binary nature are prone to rounding errors. There's a possibility of precision loss while performing calculations with ...
Alexander Ivanchenko's user avatar
7 votes

LinkedList data structure in C

An obvious limitation is that that this list can only be used for entries that can be represented as a pair of int. Making a more generic linked list is a harder ...
Toby Speight's user avatar
  • 88.3k
6 votes
Accepted

value_ptr<T> - a C++11 header-only, deep-copying smart pointer that preserves value semantics for polymorphic and undefined types

Scanning your description: The idea of this value_ptr sounds perfectly reasonable. You have a pointer to a polymorphic object, and then you want to be able to make ...
Quuxplusone's user avatar
  • 19.7k

Only top scored, non community-wiki answers of a minimum length are eligible