root/trunk/src/tutorials/examples/implicit_casting/implicit_cast.d

Revision 6, 419 bytes (checked in by jcc7, 3 years ago)

Made more progress in developing convertToWiki and added some files.

Line 
1 import std.c.stdio;
2
3 void printInt(int i)
4 {
5     printf("%d\n", i);
6 }
7
8 void printUint(uint u)
9 {
10     printf("%u\n", u);
11 }
12
13
14 void main()
15 {
16     int i = -2000000000;
17     uint j = -1000000000;
18
19
20     printInt(i);
21     printInt(j);
22    
23     printUint(i);
24     printUint(j);   
25 }
26
27 /+
28
29 Output:
30 -2000000000 // expected
31 -1000000000 // somewhat expected
32 2294967296  // nonsense
33 3294967296  // nonsense
34
35 +/
Note: See TracBrowser for help on using the browser.