bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: __func__


From: Eric Blake
Subject: Re: __func__
Date: Tue, 04 Mar 2008 20:51:10 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Simon Josefsson on 3/4/2008 7:39 AM:
|
| However, what do you think about this?
|
| /Simon
|
|>From 232f8a7255f8addd9724156d7d245b51a7feb72e Mon Sep 17 00:00:00 2001
| From: Simon Josefsson <address@hidden>
| Date: Tue, 4 Mar 2008 15:37:59 +0100
| Subject: [PATCH] Add module __func__ to provide C99 __func__ variable.
|
| ---
|  doc/gnulib.texi        |   14 ++++++++++++++
|  m4/__func__.m4         |   20 ++++++++++++++++++++
|  modules/__func__       |   20 ++++++++++++++++++++

Maybe it's just me, but I hate typing _ (it involves a shift key and some
coordination).  Can we name it modules/func rather than modules/__func__?

| address@hidden __func__
| address@hidden __func__
| +
| +The @code{__func__} module makes sure that you can use the
| address@hidden variable as defined by C99 in your code.

Should we use the C99 terminology, where __func__ is predefined
identifier?  Technically, since it is const and not an lvalue, the term
variable is a bit misleading.

| +
| +A small example is:
| +
| address@hidden
| +#include <config.h>

#include <stdio.h> /* for printf */

| +...
| +printf ("%s: something happened\n", __func__);
| address@hidden smallexample

Include a function declaration around the use of __func__ in your example,
since using __func__ outside a function is undefined.

| +  ASSERT (strlen (__func__) + 1 == sizeof (__func__));

The () around __func__ are extraneous.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHzhit84KuGfSFAYARAhxYAKCgNl3UCqlh/Ru6Ubcl+3vH3Bt4DQCbBjuz
CDFnMkZdKWEvOtIA+4uceGA=
=d+/X
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]