Displaying 3 results from an estimated 3 matches for "textlengthaft".
Did you mean:
textlengthafter
2010 Jul 16
2
[LLVMdev] Strange behavior when converting arrays to strings
...ng Text = "HelloWorld";
unsigned TextLengthBefore = Text.length();
ConstantArray *pArray = dyn_cast<ConstantArray>(llvm::ConstantArray::get(pModule->getContext(), Text, true));
unsigned NumElements = pArray->getNumOperands();
Text = pArray->getAsString();
unsigned TextLengthAfter = Text.length();
After running this example here are the values in each variable:
TextLengthBefore = 10
NumElements = 11
TextLengthAfter = 11
In the conversion from constant array to a string the null terminating character is added as part of the string and becomes the 11th character. Thi...
2010 Jul 28
0
[LLVMdev] Strange behavior when converting arrays to strings
...ng Text = "HelloWorld";
unsigned TextLengthBefore = Text.length();
ConstantArray *pArray = dyn_cast<ConstantArray>(llvm::ConstantArray::get(pModule->getContext(), Text, true));
unsigned NumElements = pArray->getNumOperands();
Text = pArray->getAsString();
unsigned TextLengthAfter = Text.length();
After running this example here are the values in each variable:
TextLengthBefore = 10
NumElements = 11
TextLengthAfter = 11
In the conversion from constant array to a string the null terminating character is added as part of the string and becomes the 11th character. Thi...
2010 Jul 28
1
[LLVMdev] Strange behavior when converting arrays to strings
...copied without
/// null termination.
static Constant *get(LLVMContext &Context, StringRef Initializer,
bool AddNull = true);
Ciao,
Duncan.
>
> unsigned NumElements = pArray->getNumOperands();
>
> Text = pArray->getAsString();
>
> unsigned TextLengthAfter = Text.length();
>
> After running this example here are the values in each variable:
>
> TextLengthBefore = 10
>
> NumElements = 11
>
> TextLengthAfter = 11
>
> In the conversion from constant array to a string the null terminating
> character is added as part of...