next up previous
Next: Type casting Up: Advanced use of gp2c Previous: Type declaration

Effect of types declaration on default values

Under GP, all GP variables start with a default value, which is 0 for local variables and 'v for gloval variable.

The gp2ccompiler follow this rule for variables declared without a type.

However, when a variable is declared with a type, gp2cwill not generate a default value are generated. This means that local(g) is equivalent to local(g:gen=0), but not to local(g:gen), and f(g)=... is equivalent to f(g:gen=0)=..., but not to f(g:gen)=....

This rule was decided for several reasons:


next up previous
Next: Type casting Up: Advanced use of gp2c Previous: Type declaration
Bill Allombert 2006-01-28