Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
harpiee
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
by
harpiee
3y ago
Smart pointers for what? I don't use any dynamically allocated memory in my firmware projects. I do sometimes use statically allocated pools for things like packet buffers and allocate chunks out of them, but their lifetimes are not sc
2.
▲
by
harpiee
3y ago
I do it mainly as a form of namespacing and aid in readability. do_thing(foo); // foo is variable do_thing(FOO); // FOO is constant (i.e this call should always do the same thing) foo = FOO; // I wann
3.
▲
by
harpiee
3y ago
With unsigned you can actually check for overflow yourself very easily z=x+y; if(z < x || z < y) // overflow And bounds checks are just a single comparisons against an upper bound (handles both over and underflow)