<div dir="ltr">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.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Dec 15, 2013 at 6:22 PM, 李永超 <span dir="ltr"><<a href="mailto:lyc364@gmail.com" target="_blank">lyc364@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi,<div>How can I obtain the upper bound of a pointer in the code? For example, I have </div><div>a pointer Ptr which points to a block of memory that is allocated by malloc, say,</div><div><br></div><div>Ptr = malloc(size);</div>
<div><br></div><div><br></div><div>Then what should I do if I am going to get the upper bound of the memory block</div><div>that is pointed to by Ptr in the runtime?</div><div><br></div><div>Thanks,</div><div>Ben</div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>