tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Is safe to memset to zero a structure with doubles?



 Is safe to memset to zero a structure with double types in the archs
supported by NetBSD?

I have read that it isn't guaranteed to work according to C
specification, although if IEEE 754 is supported, then it works. Vax
isn't IEEE 754, but hasn't problems if a double is set to 0 with
memset. It seems that computers that have problems setting floating
point numbers to 0 are very few and very old.

In the lfs code of NetBSD:
By example:

in src/libexec/lfs_cleanerd/lfs_cleanerd.c
memset(&cleaner_stats, 0, sizeof(cleaner_stats));

and cleaner_stats a structure that contains two doubles.

I think that it isn't worth to fix it, but I would like to confirm it.


Home | Main Index | Thread Index | Old Index