This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 254610

Summary: error processing simple macro #define
Product: cnd Reporter: jaisondaniel <jaisondaniel>
Component: Code ModelAssignee: issues@cnd <issues>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P2    
Version: 8.1   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: macro processing error

Description jaisondaniel 2015-08-22 09:00:33 UTC
Created attachment 155545 [details]
macro processing error

macro is not processing correctly.

take the following piece of code in netbeans 8.1beta, not sure about other version.

-------------------------------------------------------------------
//#define ASIZE 6 // uncomment this to see the error in IDE
int ASIZE=6; // comment this to see the error in IDE

void printArray(int a[]) {
	for(int i=0; i<ASIZE; i++) {
		cout << a[i] << ", " << endl;
	}
}

int main(int argc, char** argv) {
	int a[] = { 12, 23, 34, 45, 56, 67, 78, 89 };
	printArray(a);
	return 0;
}
-------------------------------------------------------------------

No issue on compilation or running. even no issue in the IDE code processing. But the same code instead of variable if you use macro #define then you can see the code processing error "Unable to resolve identifier" for all the variables and the function which the function is using the macro variable.

-------------------------------------------------------------------
#define ASIZE 6 // uncomment this to see the error in IDE
//int ASIZE=6; // comment this to see the error in IDE

void printArray(int a[]) {
	for(int i=0; i<ASIZE; i++) {
		cout << a[i] << ", " << endl;
	}
}

int main(int argc, char** argv) {
	int a[] = { 12, 23, 34, 45, 56, 67, 78, 89 };
	printArray(a);
	return 0;
}
-------------------------------------------------------------------

Please see the attached screen-shot.
Comment 1 Alexander Simon 2015-09-03 08:48:34 UTC
Not reproducible in current development build.
Please verify the issue in the last development build.
Comment 2 jaisondaniel 2015-09-07 07:49:18 UTC
Thank You for the information. I cannot verify in the dev build. But Once the next release happen I will verify this issue on the released version atleast beta version but not the dev build.