Commit 97996ed
committed
Add pointer difference support
This improves the support for pointer difference calculations and
refactors the parser by extracting complex pointer arithmetic logic into
well-named helper functions.
Limitation:
Integer pointer differences (e.g., 'int *q - int *p') are not fully
supported due to type information loss in the compilation pipeline.
When pointer variables are loaded for use in expressions, they become
temporaries without sufficient type information to determine element
size for proper scaling.
Workaround:
For integer pointer differences, cast to char* and divide manually:
((char *) q - (char *) p) / sizeof(int)
Character pointer differences work correctly because element size is 1,
requiring no scaling.1 parent 97b4f78 commit 97996ed
0 commit comments