Obscure C code (was Re: Excessive optimization)

Chuck Guzis cclist at sydex.com
Thu Dec 2 22:15:26 CST 2010


On 2 Dec 2010 at 19:30, Brent Hilpert wrote:

> Those annoying semi-colons. (Plus I hope you had "true" defined 
> appropriately.)

There are lots of those...

main()
{ 

/*   program illustrating use of pointers */

  int a, b, c;
   int *p;

    a = 10;
    b = 2;
    p = &b;      /* p points to b */
    c = a/*p;    /* divide 10/2 */
	;			  /* null statements are legal in C */
    printf( "%d divided by %d is %d\n", a, b, c);
}   

Compile and run:

D:\tmp>cl /AS x.c
Microsoft (R) C/C++ Optimizing Compiler Version 8.00c
Copyright (c) Microsoft Corp 1984-1993. All rights reserved.

x.c

Microsoft (R) Segmented Executable Linker  Version 5.60.339 Dec  5 
1994
Copyright (C) Microsoft Corp 1984-1993.  All rights reserved.

Object Modules [.obj]: x.obj
Run File [x.exe]: "x.exe" /noi
List File [nul.map]: NUL
Libraries [.lib]:
Definitions File [nul.def]: ;

D:\tmp>x
10 divided by 2 is 10

Digraphs are nasty.

--Chuck
 





More information about the cctalk mailing list