[comp.lang.c] C Trivia Question

mtoy@sgi.com (Michael Toy) (09/18/90)

Can you think of a C statement which a compiler accepts that has
a really long string of C keywords, with no operators between them?

The best I've come up with is these sets of sequences of six keywords:

typedef const unsigned long int volatile GARK;
static const unsigned long int volatile GARK;
extern const unsigned long int volatile GARK;

Michael Toy

kym@bingvaxu.cc.binghamton.edu (R. Kym Horsell) (09/18/90)

In article <1990Sep17.214906.20076@odin.corp.sgi.com> mtoy@there.sgi.com (Michael Toy) writes:
>Can you think of a C statement which a compiler accepts that has
>a really long string of C keywords, with no operators between them?
\\\

There's always

#define	long

long /* about 1 million times */ int x;

(Not exactly a `statement', but you get the idea, I'm sure).

-Kym Horsell

av@kielo.uta.fi (Arto V. Viitanen) (09/18/90)

>>>>> On 17 Sep 90 21:49:06 GMT, mtoy@sgi.com (Michael Toy) said:

Michael> Can you think of a C statement which a compiler accepts that has
Michael> a really long string of C keywords, with no operators between them?

Michael> The best I've come up with is these sets of sequences of six keywords:

Michael> typedef const unsigned long int volatile GARK;
Michael> static const unsigned long int volatile GARK;
Michael> extern const unsigned long int volatile GARK;

An if you work on MS-DOS world, you can throw in things like cdecl, pascal,
interrupt etc. ...

Michael> Michael Toy

--
Arto V. Viitanen				         email: av@kielo.uta.fi
University Of Tampere,				   	    av@ohdake.cs.uta.fi
Finland

ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) (09/18/90)

In article <1990Sep17.214906.20076@odin.corp.sgi.com>, mtoy@sgi.com (Michael Toy) writes:
> Can you think of a C statement which a compiler accepts that has
> a really long string of C keywords, with no operators between them?

> The best I've come up with is these sets of sequences of six keywords:

You can make such a sequence as long as you want:
	do do ... do ; while (0); ... while (0); while (0);
	1  2	  n    n              2          1
There's a sequence of n keywords (all "do") for any n you want.
-- 
Heuer's Law:  Any feature is a bug unless it can be turned off.

mcdaniel@adi.com (Tim McDaniel) (09/18/90)

mtoy@sgi.com (Michael Toy) writes:

   Can you think of a C statement which a compiler accepts that has
   a really long string of C keywords, with no operators between them?

According to Kernighan and Richie (and They Should Know), "sizeof" is
an operator.  It's a pity, because
   sizeof sizeof sizeof sizeof sizeof sizeof ... sizeof sizeof 0
is such an appealing candidate.
--
Tim McDaniel                 Applied Dynamics Int'l.; Ann Arbor, Michigan, USA
Work phone: +313 973 1300                            Home phone: +313 677 4386
Internet: mcdaniel@adi.com                UUCP: {uunet,sharkey}!amara!mcdaniel

brianh@hpcvia.CV.HP.COM (brian_helterline) (09/18/90)

>Can you think of a C statement which a compiler accepts that has
>a really long string of C keywords, with no operators between them?

>The best I've come up with is these sets of sequences of six keywords:

>typedef const unsigned long int volatile GARK;
>static const unsigned long int volatile GARK;
>extern const unsigned long int volatile GARK;

You can make things a little longer....

extern const unsigned long int volatile *const volatile GARK;

darcy@druid.uucp (D'Arcy J.M. Cain) (09/20/90)

In article <31530018@hpcvia.CV.HP.COM> brianh@hpcvia.CV.HP.COM (brian_helterline) writes:
>>Can you think of a C statement which a compiler accepts that has
>>a really long string of C keywords, with no operators between them?
>You can make things a little longer....
>extern const unsigned long int volatile *const volatile GARK;
Don't you consider '*' an operator?

-- 
D'Arcy J.M. Cain (darcy@druid)     |
D'Arcy Cain Consulting             |   MS-DOS:  The Andrew Dice Clay
West Hill, Ontario, Canada         |   of operating systems.
+ 416 281 6094                     |

tkacik@kyzyl.mi.org (Tom Tkacik) (09/21/90)

In article <1990Sep17.214906.20076@odin.corp.sgi.com>, mtoy@sgi.com (Michael Toy) writes:
> Can you think of a C statement which a compiler accepts that has
> a really long string of C keywords, with no operators between them?
 
> typedef const unsigned long int volatile GARK;
> static const unsigned long int volatile GARK;
> extern const unsigned long int volatile GARK;
 
How about something like

	if(0)	/* anything */				 ;
	else static const unsigned long int volatile GARK;

Is this legal?

-- 
Tom Tkacik		tkacik@kyzyl.mi.org
Speaking only for myself here in Royal Oak.

brianh@hpcvia.CV.HP.COM (brian_helterline) (09/21/90)

darcy@druid.uucp (D'Arcy J.M. Cain) writes:
>In article <31530018@hpcvia.CV.HP.COM> brianh@hpcvia.CV.HP.COM (brian_helterline) writes:
>>>Can you think of a C statement which a compiler accepts that has
>>>a really long string of C keywords, with no operators between them?
>>You can make things a little longer....
>>extern const unsigned long int volatile *const volatile GARK;
>Don't you consider '*' an operator?

	Not when I'm declaring a variable, no.  I'm just letting the
	compiler know what type it is.

karl@haddock.ima.isc.com (Karl Heuer) (09/22/90)

In article <238@kyzyl.mi.org> tkacik@kyzyl.mi.org (Tom Tkacik) writes:
>How about something like
>	if(0)	/* anything */				 ;
>	else static const unsigned long int volatile GARK;
>Is this legal?

No.  (You could have tested this yourself before posting it!)

Can we close this thread, please?  It's already been noted that `do...while'
nesting gives you an arbitrary number of consecutive keywords.

Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint