[LLVMdev] Fw: Should the Constant* pointer be declared with "const" or not?

Samuel Crow samuraileumas at yahoo.com
Wed Jan 18 11:34:24 PST 2012


Sorry!  Forgot to CC the list.


----- Forwarded Message -----
> From: Samuel Crow <samuraileumas at yahoo.com>
> To: Stepan Dyatkovskiy <stpworld at narod.ru>
> Cc: 
> Sent: Wednesday, January 18, 2012 1:31 PM
> Subject: Re: [LLVMdev] Should the Constant* pointer be declared with "const" or not?
> 
> Hello Stepan,
> 
> The LLVM source code uses a relaxed view of const correctness.  The const 
> keyword is only used when it is needed by outside code.  At one time, the 
> documentation to LLVM said that it was written in a "tasteful subset" 
> of C++.  Searching for those words doesn't hit anything any more at this 
> time.
> 
> I'd suggest you not use the const keyword for now.
> 
> --Sam
> 
> 
> ----- Original Message -----
>>  From: Stepan Dyatkovskiy <stpworld at narod.ru>
>>  To: llvmdev at cs.uiuc.edu
>>  Cc: 
>>  Sent: Wednesday, January 18, 2012 12:51 PM
>>  Subject: [LLVMdev] Should the Constant* pointer be declared with 
> "const" or not?
>> 
>>  Hi all.
>>  I'm working on patch and I'm using unchangable ConstantInt objects. 
> So 
>>  everywhere I'm using "const ConstantInt*".  But this idea 
> came to 
>>  deadlock after I tried to create ConstantVector using my vector<const 
>>  ConstantInt*> collection. All because of next form of 
> ConstantVector::get:
>> 
>>  // Note: ArrayRef declared with non-constant Constant* object.
>>  Constant *ConstantVector::get(ArrayRef<Constant*> V);
>> 
>>  What should I do in this case? Make all my ConstantInt* pointers 
>>  non-constant?
>> 
>>  -Stepan.
>> 
>>  _______________________________________________
>>  LLVM Developers mailing list
>>  LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>  http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>> 
> 




More information about the llvm-dev mailing list