473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How can I get a name of function running currently.

Hello,

I want to know the name of function() in program.
In "gcc", I know that __FUNCTION__ macro is used for getting that.
but in "cc", __FUNCTION__ macro does not exist.
I can't find function to get the name of function running currently.
Could anybody help me?
Thanks.

ps. OS is SunOS 5.8

Regards.
Nov 14 '05 #1
2 1970
On Tue, 16 Nov 2004 11:15:43 +0900, Yeounkun, Oh wrote:
Hello,

I want to know the name of function() in program. In "gcc", I know that
__FUNCTION__ macro is used for getting that. but in "cc", __FUNCTION__
macro does not exist. I can't find function to get the name of function
running currently. Could anybody help me?
Thanks.

ps. OS is SunOS 5.8

Regards.


__FUNCTION__ is a gcc extension. C99 defines __func__ as a "predefined
identifier" which will evaluate to a variable of type char[] (or static
const char[] to be precise) containing the name of the function in which
it is evaluated. There is no C89 equivalent but most compilers that
support any of the C99 standard support __func__ and many others have a
similiar extension. You don't have to do anything special to make this
functionality available (outside setting your compiler to c99 mode if
applicable).

<OT>
gcc considers __FUNCTION__ to be deprecated and newer versions treat it
the same as __func__ (there are some minor differences between the two),
you should avoid using the gcc extension for portability reasons. </OT>

Rob Gamble
Nov 14 '05 #2
"Yeounkun, Oh" <ra*****@oniontech21.co.kr> wrote in message news:<cn**********@news1.kornet.net>...
Hello,

I want to know the name of function() in program.
In "gcc", I know that __FUNCTION__ macro is used for getting that.
but in "cc", __FUNCTION__ macro does not exist.
I can't find function to get the name of function running currently.
Could anybody help me?
Thanks.

ps. OS is SunOS 5.8

Regards.


Pre C-99 there is no standard way of doing this. __FUNCTION__ is an
addtion added by gcc. C99 you can use __func__
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Pavils Jurjans | last post by:
Hallo, Is there some decent way how to get the object class name in a string format? Currently I use this: function getClassName(obj) { if (typeof obj != "object" || obj === null) return...
3
by: NeverLift | last post by:
But, if it's not open, I don't want to open it . . . using window.open will open it if it doesn't exist, even if the url in that open is null (the window is then empty -- but it's open). The...
6
by: Martin | last post by:
I'd like to be able to get the name of an object instance from within a call to a method of that same object. Is this at all possible? The example below works by passing in the name of the object...
2
by: DOA | last post by:
Help! I've been doing C language development for a long time, but this problem has me stumped. I would like the user to be able to enter the name of a function that has been linked into the...
4
by: UJ | last post by:
Is the name of process always the name of executable that is running? I'm assuming a single process for a program. So in other words - if I want to check if a program is running, can I do a...
8
by: gel | last post by:
Hi I would like to pass a variable in and use it as part of a name of an object, something like below, where I pass the variable software into the function and use it as part of the name of the...
0
by: kalyanijala | last post by:
Hi There, I have a problem running a VB program. This programs actually reads a DAT file and gives the best CPU time taken to run the program. for example I'm reading files like TN3004, TN3104 ,...
18
by: Arthur | last post by:
Hi All, I would like to get the name of the user given their networkID, is this something Active Directory would be useful for?(For intranet users) If so, can you please point me to some sample...
4
by: =?Utf-8?B?Sm9obiBTaW1wc29u?= | last post by:
Like every developer, I've got tons of error trapping code that hard code the name of the function or sub name so I can error log it. It seems from other discussions that the only way to get the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.