| ▲ | uecker an hour ago | |||||||||||||||||||||||||||||||
Two things stick out as un-idiomatic for C. First, the casts before malloc are unnecessary. This you do in C++ but not in C. Second, names with beginning underscore are reserved, and the underscore + capital letter is specifically problematic. The rest looks fairly nice but there are a couple of things I would do differently: I would not have the tests for NULL, use signed integers for indices and dimensions, use a flexible array member to integrate the data into the vector type directly, and omit the capacity field (as long as benchmarking does not show it is really needed). I would also use variably modified types for bounds checking, and with C23 the include guards become largely unnecessary. | ||||||||||||||||||||||||||||||||
| ▲ | valleyer an hour ago | parent [-] | |||||||||||||||||||||||||||||||
Names beginning with double underbar (or single underbar + capital letter) are reserved. Single underbar + lowercase is not. C23 §6.4.2.1. | ||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||