1 comment

[ 0.26 ms ] story [ 15.9 ms ] thread
In the article, it says "The Rust *struct* has a smaller size compared with the C due to the usage of smart pointers instead of allocating item memory inside the *struct*. We use *pahole* to identify that Rust *struct*s use fewer cache lines than their C counterpart."

As far as I know, you can also use pointers (not smart ones, that's a C++ thing) inside structs in C, right? Like this:

    struct student
    {
        char *name;
        int age;
        char *program;
        char *subjects[5];
    };