C++ register usage

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can anyone describe or reference a description of the calling convention used by WINAVR C++? I have found the FAQ in AVRLIB on register usage for WINAVR C but can not find anything about C++.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What exactly do you miss? Both frontends are working on the very same
AVR-specific compiler backend, so the calling conventions are the
same.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is no reference to the "this pointer." I am interested in how the calling convertion changes when "this" is passed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The this pointer is an implicit pointer passed as the first argument
to any method. NB: This is a guess only, I didn't verify it, but I'd
be much surprised if the implementation did something else. It should
be trivial to find out though by looking at the generated assembler
code.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not sure if I've been clear enough though. Suppose you've got

[code]
class foo {
...
void bar(void);
};

foo somefoo;
[code]

then a call to somefoo.bar() would look as if you had called
somefoo.bar(&somefoo) in C notation.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, that really makes it clear.