[Issue 1875] &null[x] compiles and runs, giving x
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Feb 27 15:11:14 PST 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1875
------- Comment #1 from shro8822 at vandals.uidaho.edu 2008-02-27 17:11 -------
&null[47] -> &(null[47]) -> (null + 47) -> (0 + 47) -> 47
Why is that unexpected? What should it do? if that null is not a literal the
only way to check would be to do a read but that can have problems of it's own.
also; null is a pointer. all pointers are indexable. -> null is indexable*
also it it's a way to avoid a cast for constant pointers. (Not saying it's a
good idea...)
void* HW_ptr = &null[0xf000];
* the phrasing is so classic I couldn't resist the last bit.
--
More information about the Digitalmars-d-bugs
mailing list