Computer Chess Club Archives


Search

Terms

Messages

Subject: HuARRAY

Author: rasjid chan

Date: 06:20:51 01/12/05

Go up one level in this thread


On January 12, 2005 at 04:20:05, Alessandro Scotti wrote:

>On January 12, 2005 at 02:33:31, rasjid chan wrote:
>
>>Excuse me as I only have a hazy understanding of C semantics.
>>
>>I have struct {....} PC piece[2][16];
>>
>>The following bug is from the debugger Visual C++ 4.0
>>
>>&piece[0][0]	0x0054d030
>>&piece[0][0]+16	0x0054d370
>>piece	        0x0054d030
>>piece+16	0x00550430
>>
>>Why is that pointer arithmetic don't seem to be correct -
>>piece+16 != &piece[0][0]+16.
>
>It's not a bug. Rather, piece and &piece[0][0] are pointers to different types:
>- &piece[0][0] is a pointer to PC;
>- piece is a pointer to PC[16].

Your simple clarification made me resolved the silliness in my C semantics,
the consequences of trial and error programming. So it is about...
in a declaration  T D where the declarator has the form
    D1 [ constant_expression opt ] ....

Many Thanks
Rasjid







This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.