[LLVMdev] How can I obtain upper bound of a pointer?

David Blaikie dblaikie at gmail.com
Sun Dec 15 22:26:20 PST 2013


This is rather off-topic for LLVM, it's a C programming question and the C
answer is: you can't. C doesn't expose any way to find the upper limit of
'Ptr' you just have to keep track of what size you used yourself.


On Sun, Dec 15, 2013 at 6:22 PM, 李永超 <lyc364 at gmail.com> wrote:

> Hi,
> How can I obtain the upper bound of a pointer in the code? For example, I
> have
> a pointer Ptr which points to a block of memory that is allocated by
> malloc, say,
>
> Ptr = malloc(size);
>
>
> Then what should I do if I am going to get the upper bound of the memory
> block
> that is pointed to by Ptr in the runtime?
>
> Thanks,
> Ben
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131215/197fcd06/attachment.html>


More information about the llvm-dev mailing list