Is it legal to use memset(…, 0, …) on an array of doubles?

前端 未结 7 1489
悲哀的现实
悲哀的现实 2020-12-09 07:37

Is it legal to zero the memory of an array of doubles (using memset(…, 0, …)) or struct containing doubles?

The question implies two different things:

7条回答
  •  旧巷少年郎
    2020-12-09 08:19

    Well, I think the zeroing is "legal" (after all, it's zeroing a regular buffer), but I have no idea if the standard lets you assume anything about the resulting logical value. My guess would be that the C standard leaves it as undefined.

提交回复
热议问题