Arbitrary structure initialization in CUDA

In C++, I think, it is fairly common to initialize a structure with

SomeStruct s = {0};

I believe this is supposed to initialize the first element to “0” (whatever that is), and the rest to binary zeros.
(see the article at )

However, I’ve tried this in CUDA and, although it compiles, it doesn’t seem to work.

My questions, then, are:

  1. Isn’t this behavior specified in the C++ standard? Does CUDA not follow this part?

  2. If this doesn’t work, does anyone have any suggestions for how to efficiently and succinctly intialize an arbitrary structure to 0’s? (Ideally, without manually iterating over each byte. In my case, I have a templated kernel e.g. template global void kernel(T* data), and intend to use it with ,, etc, and need to be able to initialize an element T to 0’s)