|
|
Subscribe / Log in / New account

A taste of Rust

A taste of Rust

Posted Apr 26, 2013 8:46 UTC (Fri) by VITTUIX-MAN (guest, #82895)
Parent article: A taste of Rust

"valid pointer or NULL" as in:

#define VALID 0^1^0

?


to post comments

A taste of Rust

Posted Apr 27, 2013 20:04 UTC (Sat) by mathstuf (subscriber, #69389) [Link]

This is one the main drawback of having your sentinel value(s) not being a discriminated union with your actual values. If it's not the sentinel, the code can only assume that it is valid. I suppose that in C, you could do some heuristics to check for plausible heap and stack pointers, but then if you see a pointer from some other allocator, you're going to reject perfectly valid pointers. Not to mention it being very not cross-platform.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds