4 ms·
The issue is that sizeof is most often used in function-like macros, and the user may not even realize that it's a macro. (Or that sizeof is involved in it.)
by breadbox 9y ago
The issue is that sizeof is most often used in function-like macros, and the user may not even realize that it's a macro. (Or that sizeof is involved in it.)
- tobyhinloopen 9y agoWell the user should check what that thing is you're calling, or use it with caution (ie not using side-effects as params)
- marcosdumay 9y agoThe reasonable places you can use `++` and `--` in C are exclusively: - In a bare expression, with only the variable: `i++;` (That's what usually goes into `for`.) - In a simple assignment, without any extra expression: `int a = b++;` - While updating an array index that appears nowhere else: `v[i++] = 0;` Using it anywhere else is asking for trouble. In C++, using the last one is also asking for trouble.
- syncsynchalt 9y agoThe deeper you get into C++ the more you realize that Swift made the right call by removing all four inc/dec operators.
- marcosdumay 9y agoIn-place manipulation of values is a troublemaker. C is too old for its creators to know that, given that it's the language where people got to learn that. But no newer language should carry them.