Paul Rogers wrote: >>> none of the other have the space after the asterisk. Hmmm, in case >>> the email messes up the exact spacing, the second is "left paren" >>> "asterisk" "space" "Saved...". Is that right? >>> >>> xorg-server-1.8.2/Xext/panoramiXprocs.c: return >>> (*SavedProcVector[X_PolyFillRectangle])(client); >>> xorg-server-1.8.2/Xext/panoramiXprocs.c: result = (* >>> SavedProcVector[X_PolyFillRectangle])(client); > > Note that the email wordwrap cut it after the asterisk, not before the > left paren as in the previous statement. There was a space there. > >>> >>> Can I just patch that back together? >> >> Patch what together? >> >> The line result = (*SavedProcVector[X_PolyFillRectangle])(client); >> assigns the returned value of a called function to result. >> >> SavedProcVector is an array of pointers to functions with a parameter >> of a pointer to a structure called _Client which is defined in >> include/dixstruct.h > > Yes, I got the semantics. It's not that different than other languages. > It's just a detail of the syntax I have to ask about. There is a space > between the asterisk and the "S" on one statement. Is that optional, or > must they be contiguous, as they are in all the other statements? How > does the space change the meaning, if at all?
There are two audiences when writing a program: The reader/maintainer and the compiler. Spaces in C are almost always ignored by the compiler except inside of quotes. Spacing is critical for the reader to be able to understand what's written. For example, defining a pointer is almost always done with: char *c; This is OK for the compiler and comes from the original K&R book on C programming. However it is semantically incorrect. The asterisk is a part of the type, not the variable. It should be: char* c; but could be char * c; or char*c; although I prefer char*. An example of where spaces are significant is where reserved keywords or variable names are adjacent. Something like: unsigned int i; -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
