Re: Re: elog with automatic file, line, and function

From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Pete Forman <pete(dot)forman(at)westerngeco(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Ian Lance Taylor <ian(at)airs(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: elog with automatic file, line, and function
Date: 2001-03-20 13:31:30
Message-ID: 20010320073130.A6122@lerami.lerctr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

* Pete Forman <pete(dot)forman(at)westerngeco(dot)com> [010320 04:22]:
> Larry Rosenman writes:
> > * Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> [010319 18:58]:
> > > However, if the C99 spec has such a concept, they didn't use that name
> > > for it ...
> > My C99 compiler (SCO, UDK FS 7.1.1b), defines the following:
> > Predefined names
> >
> > The following identifiers are predefined as object-like macros:
> >
> >
> > __LINE__
> > The current line number as a decimal constant.
> >
> > __FILE__
> > A string literal representing the name of the file being compiled.
> >
> > __DATE__
> > The date of compilation as a string literal in the form ``Mmm dd
> > yyyy.''
> >
> > __TIME__
> > The time of compilation, as a string literal in the form
> > ``hh:mm:ss.''
> >
> > __STDC__
> > The constant 1 under compilation mode -Xc, otherwise 0.
> >
> > __USLC__
> > A positive integer constant; its definition signifies a USL C
> > compilation system.
> >
> > Nothing for function that I can find.
>
> It is called __func__ in C99 but it is not an object-like macro. The
> difference is that it behaves as if it were declared thus.
>
> static const char __func__[] = "function-name";
>
> Those other identifiers can be used in this sort of way.
>
> printf("Error in " __FILE__ " at line " __LINE__ "\n");
>
> But you've got to do something like this for __func__.
>
> printf("Error in %s\n", __func__);
>
I couldn't find it in the docs, but it is in the compiler.

Wierd.

I'll look more.

LER

> --
> Pete Forman -./\.- Disclaimer: This post is originated
> WesternGeco -./\.- by myself and does not represent
> pete(dot)forman(at)westerngeco(dot)com -./\.- opinion of Schlumberger, Baker
> http://www.crosswinds.net/~petef -./\.- Hughes or their divisions.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Gunnar R|nning 2001-03-20 13:39:55 Re: More on elog and error codes
Previous Message Zeugswetter Andreas SB 2001-03-20 11:51:14 AW: Re: elog with automatic file, line, and function