Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Oct 1995 16:47:21 -0400 (EDT)
From:      Chuck Robey <chuckr@glue.umd.edu>
To:        Poul-Henning Kamp <phk@critter.tfs.com>
Cc:        hackers@freebsd.org
Subject:   Re: cpp question
Message-ID:  <Pine.SUN.3.91.951026164326.15336B-100000@espresso.eng.umd.edu>
In-Reply-To: <673.814700238@critter.tfs.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 26 Oct 1995, Poul-Henning Kamp wrote:

> 
> My new testament is at home, can somebody tell me in the meantime:
> 
> What do I write in a macro to make a token a string ?
> 
> I want to do something like this:
> 
> #define FOO(ptr,fmt,name) \
> 	printf("%s =" fmt "\n", XXXX, (ptr)->name)
> 
> What do I need to put at XXXX ? to convert the name to "name" ?

Testament (H&S), page 41:

#define TEST(a,b) printf( #a "<" #b "=%d\n", (a)<(b) )
TEST(0,0xFFFF);

becomes

printf("0<0xFFFF=%d\n", (0)<(0xFFFF)) );

> 
> Thanks in advance,
> --
> Poul-Henning Kamp           | phk@FreeBSD.ORG       FreeBSD Core-team.
> http://www.freebsd.org/~phk | phk@login.dknet.dk    Private mailbox.
> whois: [PHK]                | phk@ref.tfs.com       TRW Financial Systems, Inc.
> Just that: dried leaves in boiling water ?
> 

==========================================================================
Chuck Robey chuckr@eng.umd.edu, I run FreeBSD-current on n3lxx + Journey2
 
Three Accounts for the Super-users in the sky,
  Seven for the Operators in their halls of fame,
Nine for Ordinary Users doomed to crie,
  One for the Illegal Cracker with his evil game
In the Domains of Internet where the data lie.
  One Account to rule them all, One Account to watch them,
  One Account to make them all and in the network bind them.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SUN.3.91.951026164326.15336B-100000>