httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <>
Subject Re: [PATCH] Config File Line Continuation (take 3)
Date Tue, 03 Mar 1998 00:53:34 GMT
On Mon, 2 Mar 1998, Rodent of Unusual Size wrote:

> That brings up a good point.  I think I'd rather see the char == byte
> assumptions omitted when code is added - things like this are going
> to make UNICODE and similar multi-byte charsets perfectly foul to
> handle.  (If and when.)

Ha ha that's a funny one.  No way am I going to let our code be polluted
by wchar_t and associated slowness and complications when UTF-8 should
work just fine.  char == the smallest unit of allocation is guaranteed by
the ANSI C standard.  Essentially char == byte is guaranteed. 

> That is, I prefer "cp[-1]" to "*(cp - 1)".  Ben, is a negative index
> guaranteed safe for C arrays?

They're identical expressions.  X[Y] is defined to be *(X + Y) by ANSI C. 
Incidentally, it's also the same as Y[X] because of this definition.  Just
remember that C doesn't have arrays and you're much better off :)

Note that even if cp wasn't a char *, *(cp - 1) does exactly the right
thing.  It references the memory starting at cp + (-1)*sizeof(*cp). 


View raw message