Spot the bug: wchar_t buf[123]; swprintf(buf, sizeof buf, "%s/%d", str, num);
...and if you accidentally mix up which goes with which, you have buffer overflows. snprintf(buf, sizeof buf, ...) is always ok.
-
-
ok, the constant works only for local arrays. The other obvious improvement over sizeof is an ARRAY_LENGTH macro.
-
Yes,
#define countof(arr) (sizeof(arr)/sizeof(*arr)) -
But when ppl have to remember to use a countof rather than a sizeof, you have a security UX problem for programmers.
-
is there anything in C that is not a security UX problem?
-
Every interface not involving any pointers.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.