Incomplete Enum Types; Function Names As Strings - Red Hat ENTERPRISE LINUX 4 Manual

Hide thumbs Also See for ENTERPRISE LINUX 4:
Table of Contents

Advertisement

Chapter 6. Extensions to the C Language Family
6.40. Incomplete
You can define an
enum
much like what you get if you write
which does specify the possible values completes the type.
You can't allocate variables or storage using the type while it is incomplete. However, you can work
with pointers to that type.
This extension may not be very useful, but it makes the handling of
way
and
struct
union
This extension is not supported by GNU C++.

6.41. Function Names as Strings

GCC provides three magic variables which hold the name of the current function, as a string. The first
of these is
__func__
The identifier
__func__
opening brace of each function definition, the declaration
static const char __func__[] = "function-name";
appeared, where function-name is the name of the lexically-enclosing function. This name is the
unadorned name of the function.
is another name for
__FUNCTION__
However, it is not standardized. For maximum portability, we recommend you use
provide a fallback definition with the preprocessor:
#if __STDC_VERSION__
# if __GNUC__
#
define __func__ __FUNCTION__
# else
#
define __func__ " unknown "
# endif
#endif
In C,
__PRETTY_FUNCTION__
__PRETTY_FUNCTION__
example, this program:
extern "C" {
extern int printf (char *, ...);
}
class a {
public:
void sub (int i)
{
printf ("__FUNCTION__ = %s\n", __FUNCTION__);
printf ("__PRETTY_FUNCTION__ = %s\n", __PRETTY_FUNCTION__);
}
};
int
main (void)
Types
enum
tag without specifying its possible values. This results in an incomplete type,
struct foo
are handled.
, which is part of the C99 standard:
is implicitly declared by the translator as if, immediately following the
__func__
199901L
= 2
is yet another name for
contains the type signature of the function as well as its bare name. For
without describing the elements. A later declaration
. Older versions of GCC recognize only this name.
__func__
more consistent with the
enum
__func__
. However, in C++,
205
, but

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ENTERPRISE LINUX 4 and is the answer not in the manual?

Table of Contents