This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Size Weirdness in Snapshots


I compiled a program with both EGCS 1.1.1 and a recent snapshot, and noticed
a couple things. First, the snapshot give much more indepth error information.
Thanks, guys. Second, and the reason for this message follows.

$ g++ -Wall -o Solution Solution.cpp
$ ls -l Solution
-rwxrwxr-x   1 dvdeug   dvdeug   5105 Feb 13 21:06 Solution
$ g++-ss -Wall -o Solution Solution.cpp
$ ls -l Solution
-rwxrwxr-x   1 dvdeug   dvdeug  33271 Feb 13 21:06 Solution
$ g++ -v
Reading specs from /usr/lib/gcc-lib/i486-linux/egcs-2.91.60/specs
gcc version egcs-2.91.60 Debian 2.1 (egcs-1.1.1 release)
$ g++-ss -v
Reading specs from /usr/local/egcs/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.93.04/specs
gcc version ecs-2.93.04 19990131 (gcc2 ss-980929 experimental)

As you can see, the snapshot produced a much larger executable file than 
the old version. I don't know if it's relevant - making EGCS an efficent
optimizer of empty programs isn't very useful. It was weird, however, and
may be indictive of something. Is further study warrented?

The program:
#include <cassert>
typedef unsigned int NumOfPieces; // 0 .. 48
const unsigned int MinNumOfPieces = 0;
const unsigned int MaxNumOfPieces = 48;
const unsigned int PiecesEachHole = 4;

class Board {
	private:
		// 14 holes, including both ends
		NumOfPieces Holes[14];
	public:
		Board() {
			// Start with both ends = 0
			Holes[0] = Holes[14] = 0;
			// Put 4 pieces in each other hole
			Holes[1] = Holes[2] = Holes[3] = Holes[4] = Holes[5]
			         = Holes[6] = Holes[8] = Holes[9] = Holes[10]
				 = Holes[11] = Holes[12] = Holes[13] 
				 = PiecesEachHole;
		}
			
		void Invariant() {
			NumOfPieces Sum = 0;
			for (int I = 0; I < 14; I++) {
				Sum += Holes[I];
				assert (Holes[I] <= 48);
			};
			assert (Sum == MaxNumOfPieces);
		}

		NumOfPieces Hole(unsigned int HoleNum) {
			return Holes[HoleNum];
		}

		void MovePiece(unsigned int StartHN, unsigned int EndHN) {
			assert ((Invariant(), true));
			Holes[StartHN]--;
			Holes[EndHN]++;
			assert ((Invariant(), true));
		}	
};

int main () {
}
-- 
The irony is, there ARE drugs that ENHANCE it. This says something profound about either science or medicine or people or muppets or all four. - S. John Ross


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]