Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
dibbit
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
3 ms
·
1.
▲
by
dibbit
14y ago
Maybe, but it will catch bugs like this if the test is written for it, and anyone writing C in the 21st century professionally, with safety in mind, is a) writing tests, and b) getting 100% coverage.
2.
▲
by
dibbit
14y ago
It made sense when portability from C to C++ was important, as in now and for as long as both languages have constancy.
3.
▲
by
dibbit
14y ago
Run the code and see for yourself, parent fixed it.
4.
▲
by
dibbit
14y ago
It does matter. sizeof is computed at compile time, it is not computed at runtime. something() is a runtime invocation .. sizeof() 'looks' like that, but isn't.
5.
▲
by
dibbit
14y ago
There actually is a good reason not to use parens with sizeof, and it is in fact a means of introducing subtle bugs to your code if you don't know the difference: sizeof some_struct; //computed at *compile* time sizeof(some_struct