Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
mklencke
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
3 ms
·
1.
▲
by
mklencke
12y ago
In some cases, 2x or 4x is worth the risk. Imagine having a warehouse-scale computer where you can use 50,000 CPUs instead of 200,000.
2.
▲
Open Access needs Open Education and Vice-Versa
(malariaworld.org)
1 points
by
mklencke
15y ago
|
0 comments
3.
▲
by
mklencke
15y ago
I'm just making it up as I go along, it's not the prettiest thing. What would you do, in C?
4.
▲
by
mklencke
15y ago
True, but that can be overcome by another function that just gives you an address to put a new item. You would say, for example: *(int *)vector_expand(v) = 2;
5.
▲
by
mklencke
15y ago
In this case, I'm not storing void pointers in the data structure, but I'm using the void pointer as a direct address into "elements". The memory layout is just a sequence of items of length elem_size. vector_push copies the item into that
6.
▲
by
mklencke
15y ago
The RAII benefits are definitely there and STL containers are pretty awesome, but you can still create generic containers in C by using void pointers. For example, a simple vector API: typedef struct { void *elements; int elem_size; int