This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: A little bit of C fun...
- From: me22 <me22 dot ca at gmail dot com>
- To: "John Carter" <john dot carter at tait dot co dot nz>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 22 Oct 2008 01:03:42 -0400
- Subject: Re: A little bit of C fun...
- References: <alpine.DEB.1.00.0810221735040.30487@parore.tait.co.nz>
On Wed, Oct 22, 2008 at 00:44, John Carter <john.carter@tait.co.nz> wrote:
>
> Consider for a moment this program excerpt...
> a(&(b){c})
>
> Is this valid C++?
>
> Is this valid C?
>
> What would you need to do to get this to compile?
>
Use the preprocessor. Otherwise you can't get braces inside parens.
#define c return 0;
#define b d)
#define a(T) int d; if (T
int main() {
a(&(b){c})
}
> What does it do?
>
Whatever you want.
> Could it be tweaked into something useful? (apart from using it to
> hurt people's brains with.)
>
No.