Brad Douglas wrote:
> > some minutes ago I have submitted a fix from Roberto Antolin
> > to fix a v.outlier problem. It fixes a crash if qgis=name
> > isn't used (so, maybe use that and it works)?
>
> C question re that fix: (vector/lidar/v.outlier/main.c)
>
> /* Structs' declarations */
> struct Map_info In, Out, Outlier, Qgis;
> struct Option *in_opt, *out_opt, *outlier_opt, *qgis_opt, *passoE_opt, *passoN_opt, \
> *lambda_f_opt, *Thres_O_opt;
>
>
> is the end of line "\" harmful or treated like whitespace?
It's interpreted as string literal concatenation. In my experience,
it's useful with strings:
Okay for gcc:
fprintf(stderr, "blah blah"
"more blah blah");
More appropriate:
fprintf(stderr, "blah blah" \
"more blah blah");
I'm sure Glynn has details, but that is my understanding. I don't know
if the same issues apply with variable declaration, but it isn't
necessary at least with gcc.
The use of backslash-newline sequence is only useful in preprocessor
directives, which are terminated by any line break (LF on Unix, CRLF
on Windows, etc) which is not immediately preceded by a backslash.
In the above case, it's entirely unnecessary; a newline is treated no
differently to a space or tab in normal C code.
As for string concatenation: the preprocessor automatically
concatenates adjacent string literals, i.e. those which are separated
only by whitespace. E.g. the following are all equivalent:
printf("hello world\n");
printf("hello" " " "world" "\n");
printf("hello "
"world\n");
--
Glynn Clements <glynn@gclements.plus.com>