On 06/30/2010 06:36 PM, Lawrence D'Oliveiro wrote: > In message <mailman.2369.1277870727.32709.python-l...@python.org>, > Michael Torrie wrote: > >> Okay, I will. Your code passes a char** when a char* is expected. > > No it doesn’t.
You're right; it doesn't. Your code passes char (*)[512]. warning: passing argument 1 of ‘snprintf’ from incompatible pointer type /usr/include/stdio.h:385: note: expected ‘char * __restrict__’ but argument is of type ‘char (*)[512]’ > And so you misunderstand the difference between a C array and a > pointer. You make a pretty big assumption. Given "char buf[512]", buf's type is char * according to the compiler and every C textbook I know of. With a static char array, there's no need to take it's address since it *is* the address of the first element. Taking the address can lead to problems if you ever substitute a dynamically-allocated buffer for the statically-allocated one. For one-dimensional arrays at least, static arrays and pointers are interchangeable when calling snprinf. You do not agree? Anyway, this is far enough away from Python. -- http://mail.python.org/mailman/listinfo/python-list