changeset 317:188082b88d85

cast(uint/int) zwang <nehzgnaw@gmail.com> 2005-03-07 news:d0hio7$2bs6$1@digitaldaemon.com
author thomask
date Thu, 17 Mar 2005 15:20:24 +0000
parents bebf25858c08
children bb7273309924
files run/cast_22.d
diffstat 1 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/cast_22.d	Thu Mar 17 15:20:24 2005 +0000
@@ -0,0 +1,29 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	zwang <nehzgnaw@gmail.com>
+// @date@	2005-03-07
+// @uri@	news:d0hio7$2bs6$1@digitaldaemon.com
+
+module dstress.run.cast_22;
+
+uint f(){
+        uint r;
+        uint* p = cast(uint*)&r;
+        *p = 1;
+        return r;
+}
+
+uint g(){
+        uint r;
+        int* p = cast(int*)&r;
+        *p = 1;
+        return r;
+}
+
+int main(){
+        assert(f()==1);
+        assert(g()==1);
+	return 0;
+}