Ranier Vilela <ranier...@gmail.com> writes: > I found, I believe, a serious problem of incorrect usage of the memset api. > Historically, people have relied on using memset or MemSet, using the > variable name as an argument for the sizeof. > While it works correctly, for arrays, when it comes to pointers to > structures, things go awry.
You'll have to convince people that any of these places are in fact incorrect. Everyone who's used C for any length of time is well aware of the possibility of getting sizeof() wrong in this sort of context, and I think we've been careful about it. Also, as a stylistic matter I think it's best to write "memset(&x, 0, sizeof(x))" where we can. Replacing sizeof(x) with sizeof(some type name) has its own risks of error, and therefore is not automatically an improvement. regards, tom lane