|
From: Barry J. <zen...@ze...> - 2020-08-21 10:33:45
|
On 21/08/2020 07:24, Christian Schoenebeck wrote: > On Freitag, 21. August 2020 02:04:52 CEST Barry Jackson wrote: >> Hello, >> Quick question: >> >> https://svn.linuxsampler.org/cgi-bin/viewvc.cgi/linuxsampler/trunk/src/netwo >> rk/lscp.y?r1=3054&r2=3787&pathrev=3787 >> >> I am not a programmer but I do maintain the Linuxsampler package for Mageia. >> >> To me the above code looks as though there may be a typo in it? >> >> Is the space after # on line 1486 correct? > > It is correct, both in C as well as in C++. A preprocessor statement must > start with a '#' character at the start of the line, but it is not mandatory > for the actual preprocessor statement to follow that '#' character > immediately. > > Space indents like this one are commonly used to clearly structure nested > preprocessor statement blocks, i.e. > > #if foo > # if bla > # define something 0 > # else > # define something 1 > # endif > #else > # if bla > # define something 2 > # else > # define something 3 > # endif > #endif > > is better for the eye than: > > #if foo > #if bla > #define something 0 > #else > #define something 1 > #endif > #else > #if bla > #define something 2 > #else > #define something 3 > #endif > #endif > > This comes especially handy if somebody accidentally breaks the structure when > the software evolves. The indents allow to recover the structure easily. > > CU > Christian > > Thanks Christian for your quick reply, this is a case of 'a little knowledge (on my part) is dangerous' :) I am familiar with indentation in bash etc., but not preprocessor statements in C. Cheers, Barry |