Re: ValueType reference in objects



Hey

You could try creating a custom integer class and pass it to the your
cons instead of int
Peter Duniho wrote:
"Andre Azevedo" <Andre Azevedo@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:6C65D414-810D-4827-97D1-08D25BA4E48D@xxxxxxxxxxxxxxxx
C# copies the value from the i variable to the object heap field i.
Is this correct? Heap object doesn´t point to stack variables?

No, it doesn't. There might be a way to generate a reference to a local
variable, but if there is I don't know what it is, and for sure the code you
posted doesn't. Except, of course, as the "by reference" parameter in the
constructor...but in that case, you still can't access the reference
directly, it just means that if you change the value of the parameter in the
constructor, the original variable passed in is changed as well. That
behavior does not extend to other values to which the parameter is assigned.

Pete

.



Relevant Pages

  • Re: [PATCH] Make futex waiters take an mm or inode reference
    ... Make futex waiters take an mm or inode reference ... Rusty Russell wrote: ... +static inline void drop_key_refs ... -static int futex_wake ...
    (Linux-Kernel)
  • Re: dynamic type checking - a pauline conversion?
    ... it depends on the type of reference to the object. ... In Smalltalk the reference doesn't have a type but the instance does ... and C++ can not guarantee type correctness at compile ...
    (comp.object)
  • Re: Simplicity
    ... > ByRef (by reference) ... > Dim k as Zone ... property int Value; ... Microsoft C/C++ Optimizing Compiler Version 14.00.40809 ...
    (comp.lang.cpp)
  • Re: hash two keys to one index
    ... What goes into the map are pairs of (reference to key, ... When I insert an object into the hash table, I pass in ... void insert(Object obj, int hash) throws HashTableFull ... int probe = 0; ...
    (comp.lang.java.programmer)
  • Re: Assigning to references
    ... a reference ... behaves exactly like the object it refers to (it is an "alias" for that ... int a = 1; ... Bear in mind that, unlike a reference, a pointer will not extend the ...
    (comp.lang.cpp)