Wolf480pl on Nostr: Is this UB when p is null? int bar(struct foo *p) { int *py = &p->y; if (!p) { return ...
Is this UB when p is null?
int bar(struct foo *p) {
int *py = &p->y;
if (!p) {
return 0;
}
return *py;
}
Published at
2025-02-14 18:02:50Event JSON
{
"id": "0f3c20d372b076be2fd183c9b3b95fbf2d6cc40d74af0da454ac65ccf44db043",
"pubkey": "f3eaf89270fc0355ce2a91d69bca71c340a0a38b7c833b8ff837e8aaa0c98e82",
"created_at": 1739556170,
"kind": 1,
"tags": [
[
"proxy",
"https://mstdn.io/users/wolf480pl/statuses/114003553221980912",
"activitypub"
]
],
"content": "Is this UB when p is null?\n\nint bar(struct foo *p) {\n int *py = \u0026p-\u003ey;\n if (!p) {\n return 0;\n }\n return *py;\n}",
"sig": "4f12bdbc6e7b8730d81e655edf26fd7a488f213fd5dfcff2c649e38f70bdfaf46dff3e025b7ce597e51eacbbdd99c2a1bc3bb3fa140ffa60e4ddaf99420576b4"
}