Re: [cc65] C question

Date view Thread view Subject view

From: Spiro Trikaliotis (trik-news_at_gmx.de)
Date: 2002-12-12 21:15:46


Hello Shawn,

Shawn Jefferson wrote:

> Sorry, I thought that posting that little bit was enough for someone to tell 
> me if what I was doing is legal/correct in C.  I thought you could index from 
> a pointer with [].  I'm using cc65 2.8.0, BTW.

another possibility is that the precedence is not as you suspect.

bmp->dat[((10 * y) + byte)]

can be 

1. (bmp->dat)[((10 * y) + byte)]

or 

2. bmp->(dat[((10 * y) + byte)])


IIRC, in C, variant 1 is used, but you might want to use variant 2, depending
upon your application. Anyway, it might be the other way around.

Since I don't remember these semantics, I always explicitly put parenthesis
around, so I'm sure the compiler and me, we understand each other. :-)

Spiro.


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2002-12-12 21:17:08 CET