Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!uwvax!oddjob!maryland!eneevax!umd5!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.UUCP Newsgroups: comp.lang.c Subject: Re: Can a subfunction find the name of the calling function? Message-ID: <5818@brl-smoke.ARPA> Date: Thu, 30-Apr-87 20:11:33 EDT Article-I.D.: brl-smok.5818 Posted: Thu Apr 30 20:11:33 1987 Date-Received: Sat, 2-May-87 01:36:20 EDT References: <12620001@acf4.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 17 In article <12620001@acf4.UUCP> woo@acf4.UUCP (Alex C. Woo) writes: >Is there anything comparable to getarg and iargc for subroutines >or functions? How can a function determine the name of the function >which calls it or the number of calling arguments, either in C >or f77? Since none of the source code symbols are necessarily around at run time, in general the names of functions are not available at run time. There is no built-in way to determine number of arguments, either. Once upon a time there was a nargs() function for this, but it really just returned the parameter stack size in words, not the number of arguments (which is harder). I don't know what good either one would do in the general case. The bottom line is, "no, you can't do that, at least not portably".