httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David D'Antonio" <>
Subject RE: [PATCH] Config File Line Continuation (take 3)
Date Tue, 03 Mar 1998 15:21:31 GMT
On Monday, March 02, 1998 8:00 PM, Jim Jagielski [] wrote:
> Rodent of Unusual Size wrote:
> > 
> > That is, I prefer "cp[-1]" to "*(cp - 1)".  Ben, is a negative index
> > guaranteed safe for C arrays?
> > 
> Only if it's known and guaranteed that the data refered to actually
> exists.

Safe? For C Arrays? Er, ah, C doesn't HAVE arrays, it has a funky array-like
syntax for referencing memory via pointers. As Dean pointed out, cp[-1] is
identical to *(cp - 1). Now, what you GET when you dereference the pointer
is not the compiler's problem. :-) If cp == 0, then you're in trouble...

So, you're right. If the data is known and guaranteed to exist, its fine.

>       Jim Jagielski            |       jaguNET Access Services
>           |
>             "Look at me! I'm wearing a cardboard belt!"


David D'Antonio CNE -
 Some they do and some they don't and some ya just can't tell
  Some they will and some they won't and some it's just as well

View raw message