A little bit of C fun...

me22 me22.ca@gmail.com
Wed Oct 22 05:04:00 GMT 2008


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.



More information about the Gcc-help mailing list