top | item 46154480

(no title)

kanbankaren | 2 months ago

30 years in C/C++ here.

Give an example of UB code that you have committed in real life, not from blogs. I am genuinely curious.

discuss

order

gf000|2 months ago

All the memory safety vulnerabilities, which are the majority of bugs in most C/C++ projects?

jech|2 months ago

> Give an example of UB code that you have committed in real life

    struct foo {
        ...
        atomic_int v;
        ...
    };
    
    struct foo x;
    memset(&x, 0, sizeof(x));

rwbt|2 months ago

I don't think it's UB if you init the struct before using it atomically from multiple threads.