Bzero?

I like to use the clib function bzero to zero out my arrays and data structures. I can’t seem to use this within root because the #include <strings.h> seems to break the CINT interpreter. I can use memset which requires #include <string.h> (not strings.h) which is an ok workaround. But I was wondering if people just don’t use bzero? I’m running root v5.26.00 built on a stock REHL 5. (gcc 4.1.2) What’s the most common way to zero out an array in CINT?

Cheers. Steve.

Hi,

you can simply use int v[20] = {0}. That is also the most efficient way for compiled code.

Cheers, Axel.

[quote=“Axel”]you can simply use int v[20] = {0}. That is also the most efficient way for compiled code.
[/quote]

Note that this only works (I believe) when declaring a variable and won’t work zeroing out an array that is already declared.

Cheers,
Charles

Hi,

yes, that’s correct. If needed I can of course make bzero() available though - as Stephen has already pointed out - memset() is a viable alternative.

Cheers, Axel.