Spot the bug: wchar_t buf[123]; swprintf(buf, sizeof buf, "%s/%d", str, num);
-
-
Er, in that case it means I can't subtract it from the buffer size.
-
If I were to change something here, it would be sizeof, which does the "wrong" thing for pointers too.
-
You can differ all you like philosophically but it doesn't mitigate danger of interfaces that look like they take a size
-
How many people even know if swprintf takes a size or wchar_t count without looking it up?
-
I posit that if there's a choice, "count" is always the right answer. Other langs don't even have access to byte-size.
-
Well you can't remove sizes from C without having a radically different language (no Representation of Types).
-
Which wouldn't necessarily be a bad thing, but it's outside the scope of bad interface designs within the context of C.
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.