Skip to content

Instantly share code, notes, and snippets.

@sw17ch
Created November 21, 2012 03:49
Show Gist options
  • Save sw17ch/4122906 to your computer and use it in GitHub Desktop.
Save sw17ch/4122906 to your computer and use it in GitHub Desktop.

The File

int * global_ptr;

int * func(int * param_ptr)
{
  int * local_ptr = 0;

  {
    int * sub_scope_ptr = 0;
  }

  int * foo(int * foo_param)
  {
    int * local_foo;
    {
      int * sub_foo_param = 0;
    }

    return local_foo;
  }

  return local_ptr;
}

The Session

$ runhaskell check_ptrs.hs -f test.c 
POINTER: global_ptr -- test.c:1
POINTER: param_ptr -- test.c:3
POINTER: local_ptr -- test.c:5
POINTER: sub_scope_ptr -- test.c:8
POINTER: foo_param -- test.c:11
POINTER: local_foo -- test.c:13
POINTER: sub_foo_param -- test.c:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment