hgm wrote:The way I figured it ChessSquare would indeed be a single byte (less than 256 piece types). Thus Board would be an 8x8 array of bytes, i.e. 64 bytes.
Board is an array type, i.e. "array of 8 of (array of 8 of (ChessSquare))"
hgm wrote:I expect board and boards[0] to be of the same type, namely type Board. Objects of type Board should be pointers, as they can be indexed (twice). So I am taking the difference of two pointers of the same type.
The parameter board has the same array type as Board, which means you have to pass something which is a Board to it. But when the name of a variable with array type is used without indexing, it can decay into a non-array type, in this case "pointer to (array of 8 of (ChessSquare))".
I think what's happening is that both array expressions (board and boards[0]) are decaying into pointers, and you then compute the difference between those pointers. The pointers both have the same type, "pointer to (array of 8 of (ChessSquare))". Since sizeof(array of 8 of ChessSquare) is 8*sizeof(ChessSquare), and sizeof(Board) is 64*sizeof(ChessSquare), it makes sense that you'd get (64/8) == 8 as the result.
I can't think of any sensible explanation for getting 16, though!
hgm wrote:But I was led to believe that when subtracting two pointers, the difference (in bytes) would be divided by the size of the object pointed to, i.e. boards[1] - boards[0] should always be 1, irrespective of sizeof(boards[0]).
That doesn't sound right to me. However, (&boards[1] - &boards[0]) should always be 1, since it is morally equivalent to ((boards+1) - (boards+0)).
hgm wrote:The fact that the address of boards[1] was passed as an argument called board should not really matter. Yet I get 16, and François 8 (presumably because the size of 64 bytes is divided by sizeof(int), and I have a 32-bit machine). This seems incorrect to me. Especially that sizeof(int) should have an effect is very fishy, as ints did not enter the equation anywhere...
Am I stupid or what?

It does in fact pass the address of boards[1], but that parameter doesn't have the type of pointer-to-type-of(boards[1]). Its passing a pointer to ChessSquare[8], not a pointer to ChessSquare[8][8].
I wonder if the ChessSquare[8] type somehow decays into a ChessSquare* ? That would seem like a compiler bug, but if it did, you would have a ChessSquare** and taking 64 bytes divided by sizeof(ChessSquare*)==4 would give you your 16. Hmm, I'm confused..