I've got a structure with C representation:

struct Scard_IO_Request
    proto: u32,
    pciLength: u32

when I want to ask the sizeof (like in C sizeof()) using:


I get compilation error:

"error: sizeof is a reserved keyword"

Why can't I use this sizeof function like in C? Is there an alternative?

The standard library function is std::mem::size_of (with an underscore before of).

Uhh... memory - How to get the size of a user defined struct? (sizeof) - Stack Overflow

It looks like this was simultaneously posted in both places, but the post here was caught in a spam filter for a day waiting for admin review.

Ah; so what you're saying is the forum is a nasty little liar when it comes to timestamps? :stuck_out_tongue:

I was very impatient. The stackoverflow solved it.
But thanks anyway.