Re: Sparse parsing question: string literal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Chris,

On 20 August 2017 at 14:05, Christopher Li <sparse@xxxxxxxxxxx> wrote:
> On Sun, Aug 20, 2017 at 8:31 AM, Dibyendu Majumdar
> <mobile@xxxxxxxxxxxxxxx> wrote:
>> I am looking at the parse tree for following snippet:
>>
>> void main(int argc, const char *argv[])
>> {
>> 5;
>> 6.5;
>> "hello";
>> }
>>
>> I see that 5 is treated as EXPR_VALUE, 6.5 as EXPR_FVALUE, but "hello"
>> is treated as EXPR_SYMBOL. Why is that?
>
> Because "hello" is array of char from type point of view.
>
> It is same as
> char no_ident [] = {'h', 'e', 'l', 'l', 'o', '\0'};
>
> except it does not have the name(sym->ident) for this symbol.
>

I see - so every string literal results in an un-named symbol, whose
initializer is set to the string expression?

Regards
Dibyendu
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux