Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#220 line continuation causing global var to be seen as local var

open
5
2012-12-29
2007-10-22
Anonymous
No

Hi all,

The following code will trick the cscope to think that "int parm" is a local variable within a function called "defined" instead of a global variable; therefore, when you try to search for symbol "parm" under cscope "Find this global definition:", you won't be able to find it. Consider the code below.

#include <stdio.h>

#if defined(__FOO1__) \ || defined(__FOO2__) /* <<- this line continuation causes cscope to seeing parm as local instead of global */
#define SOMETHING
#endif
int parm;
int main ()
{
parm = 2;
printf ("parm=%d\n", parm);
}

The cscope properly detects "int parm" in the code segment below.

#include <stdio.h>

#if defined(__FOO1__) || defined(__FOO2__)
#define SOMETHING
#endif
int parm;
int main ()
{
parm = 2;
printf ("parm=%d\n", parm);
}

Regards,
Adisorn.

Discussion