No. Why do you want to?
Go doesn't distinguish - returning from the function won't invalidate the
pointer, even if you think it should be on the stack.
On Tue, 26 Feb 2013, Robert Sandra wrote:
> Hi all,
>
> I am now reading the go compiler code. I am wondering if we can check
> whether a pointer is pointing to a stack address or a heap address?
>
> Take the following codes as an example:
>
> type Vertex struct{
> X, Y int
> }
>
> p := V{1,2}
> q := new(Vertex)
> m := &p
>
> then we know that m is a pointer pointing to a local variable in the stack,
> while q is pointing to a heap address.Can we differentiate these two
> different types of pointer statically? By saying statically, I mean during
> the compiling time.
>
> Thanks.
> Robert
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
golang-nuts...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>
>
--
Scott Lawrence
go version go1.0.3
Linux baidar 3.7.9-1-ARCH #1 SMP PREEMPT Mon Feb 18 02:13:30 EET 2013 x86_64 GNU/Linux