Re: Calling function name



junky_fellow@xxxxxxxxxxx writes:
> Saroj wrote:
>> Is there an way for a function to know who called him ?
>
> I think it cannot be done portably. You will need to write
> an implementation specific code for that.
> You will need to know the C calling convention for that
> architecture. For eg. in PowerPC, when a function is called
> the return address is put in Link Register (LR).

That will, at best, give you the address of the caller, not its name.

Anything like that is horrendously non-portable, and probably not
worth the effort. If that's the solution, try to redefine the
problem.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.



Relevant Pages

  • Re: [PATCH 5/8] mm: follow_hugetlb_page flags
    ... Can call it that if you prefer, either name suits me. ... it's not worth the hassle. ... so worth a patch on top to keep you sweet! ... I did originally want to do it that way, but the caller is holding ...
    (Linux-Kernel)
  • Re: Referencing a type w/o included source?
    ... code (caller and recipient)? ... Brett ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • cant see discussion group message content
    ... worth of posts at a time. ... I would like to back to my old way of viewing these discussions through the ... Prev by Date: ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: This Morning
    ... The situation for Adrians friend could have ... gone down the toilet if the other officers hadn't turned up - it just ... wasn't worth it. ... Prev by Date: ...
    (uk.rec.driving)
  • Re: Another Q regarding SHR on IIGS...
    ... According to Apple ... that means the memory is not accessed linearly. ... Well, it's worth a try! ... Prev by Date: ...
    (comp.sys.apple2.programmer)