🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by John Carlson Wed, 02 Sep 1992 10:38
Increment and assignment (sleepy programmers see section 3.1 of C FAQ)
#1043
Author: John Carlson
Date: Wed, 02 Sep 1992 10:38
18 lines
814 bytes
int i = 0;
i = i++;
printf("%d\n", i);

Values of i:

Sun 4.1.1 cc compiler produces: 1
Sun C++ 2.1 produces: 1
Optimized gcc produces: 1
Unoptimized gcc 2.2.2 produces: 0
AT&T cc compiler produces: 0

Don't use i = i++.

It would be nice if the compiler warned me about it.

John Carlson
carlson@yottzumm.tis.llnl.gov
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads