This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [patch] for PR 17531



On Sep 27, 2004, at 8:44 PM, Zdenek Dvorak wrote:
short a[100];
short b;

for (b = 0; b < 100; b++)
  a[b] = 2 * b;

to

short a[100];
short *p;

for (p = &a; p < &a + 200B; p += 2B)
  *p = (short) (p - &a);

is perfectly valid.

Yes but pointer - pointer = size_t so there is a cast to size_t first and then to short.

-- Pinski


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