a problem with references

Niovol niovol at gmail.com
Thu Apr 26 02:43:54 PDT 2007


How can I use references?
I found an example:
line 1|  //
line 2|  void def(ref int x)
line 3|  {
line 4|      x += 1;
line 5|  }

But this example doesn't work on my computer. The errors appear:
-----------------------
C:\Work\NeuroV.d\main.d(3): found 'int' when expecting ')'
C:\Work\NeuroV.d\main.d(3): semicolon expected following function
declaration
C:\Work\NeuroV.d\main.d(3): no identifier for declarator x
C:\Work\NeuroV.d\main.d(3): semicolon expected, not ')'
C:\Work\NeuroV.d\main.d(3): Declaration expected, not ')'
C:\Work\NeuroV.d\main.d(5): unrecognized declaration
--------



More information about the Digitalmars-d mailing list