[LLVMdev] c const

Chris Lattner sabre at nondot.org
Thu Aug 16 09:09:02 PDT 2007


On Thu, 16 Aug 2007, Holger Schurig wrote:
>> if the programmer is going to tell you that the memory pointed
>> to by a pointer argument is never written.
>
> There are ways to cast away a const.

You don't even need casts:

void foo(const int *P, int *Q) {
   x = *P;
   *Q = 1;
   y = *P   // redundant?
}

void bar() {
   int X = 0;
   foo(&X, &X);
}

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list