Jump to content

Undefined values: Difference between revisions

(GP and PARI)
Line 119:
}</lang>
So it's a little compiler magic but in the end works just as one would expect.
 
=={{header|D}}==
In D variables are initialized either with an explicit Initializer or are set to the default value for the type of the variable. If the Initializer is void, however, the variable is not initialized. If its value is used before it is set, undefined program behavior will result.
<lang d>// initialized
int a = 5;
double b = 5.0;
char c = 'f';
int[] d = [1,2,3];
 
// default initialized
int aa; // set to 0
double bb; // set to double.nan
char cc; // set to 0xFF
int[] dd; // set to null
int[3] ee; // set to [0,0,0]
 
// undefined
int aaa = void; // assert(aaa != 0)
double[] bbb = void; // assert(bbb !is null)
int[3] eee = void; // contains garbage</lang>
 
=={{header|Delphi}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.