Re: [Vala] Printfing an object



On 17/11/2013 16:03, Luca Bruno wrote:
It's not possible to do that for every type.
Anything wrong with this approach?

public class Obj : Object {
  public string foo;
}

public void main() {
  var o = new Obj();
  var o1 = new Obj();
  var o2 = new Obj();

  stdout.printf("%p\n", &o); //<-- gives me a nice hex address.
  stdout.printf("%p\n", &o1);
  stdout.printf("%p\n", &o2);
}

Plus, how could I get that printf "%p" address (e.g "0x7fff70ffbb98") into a string variable?


Thanks,
/d


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]