Skip to content

Conversation

jserv
Copy link
Collaborator

@jserv jserv commented Aug 26, 2025

This commit adds comprehensive pointer difference support (ptr1 - ptr2) that was missing from the existing pointer arithmetic implementation:

  • Pointer difference calculation: It computes element count by dividing byte difference by element size (char=1, int=4, etc.)
  • Expression support: Enables complex expressions like *(p + (q - r))
  • Unified element size detection: Consistent logic for both regular and typedef pointers across all arithmetic operations

This commit adds comprehensive pointer difference support (ptr1 - ptr2)
that was missing from the existing pointer arithmetic implementation:
- Pointer difference calculation: It computes element count by dividing
  byte difference by element size (char=1, int=4, etc.)
- Expression support: Enables complex expressions like *(p + (q - r))
- Unified element size detection: Consistent logic for both regular and
  typedef pointers across all arithmetic operations
@jserv jserv force-pushed the pointer-arithmetic branch from 09c4618 to e791a2b Compare August 26, 2025 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant