Re: GCC 4.8 libcpp Issue...Possibly Related To (FIXED)

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

 



On Sat, Nov 2, 2013 at 5:10 PM, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote:
> On 2 November 2013 21:03, Cyd Haselton <chaselton@xxxxxxxxx> wrote:
>> On Sat, Nov 2, 2013 at 8:28 AM, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote:
>>> On 27 October 2013 23:36, Cyd Haselton wrote:
>>>> Android apparently doesn't support implicit conversion so had to do a
>>>> cast before the argument is passed.
>>>
>>> N.B. it's not "Android" that doesn't support conversion from long
>>> long* to long*, it's C++.
>>
>> Not sure what N.B. means...
>
> Did you try asking the web?
> http://en.wikipedia.org/wiki/Nota_bene

Honestly?  I thought that there were so many things that N.B. could
stand for that I didn't bother.  Or I was so tired I didn't care.
Take your pick.
>
>
>> This is probably an obvious question but since I'm still working my
>> way through C I have to ask:  If C++ does not support that conversion,
>> why is it in the code?  And does C++ not support implicit conversion
>> from long long* to long* or explicit, or both?
>
> The code passes the address of the field st_size to a function taking off_t*.
>
> The relevant standard says st_size should be type off_t, so there is
> no conversion needed, and the code is correct.

Ah.  I think I see.  C++ doesn't support implicit conversion but, in
this case, implicit conversion should not be happening; st_size should
be type off_t unless you're porting to Android in which case it's only
off_t if you're targeting a mips platform.

And thanks for this suggestion:

> You could try:
>
> off_t ot = file->st.st_size;
> Then pass &ot into the function and then:
> file->st.st_size; = ot;

After several tweaks in other areas the build finished and the cc1
binary runs correctly on device.  Looking back I'd added this:

off_t ot = file->st.st_size
funct(args, &ot)

then, when that didn't work I tried several variations of this:

off_t *ot                          <---also off_t ot
*snip*
off_t ot = file->st.st_size  <---also &file->st.st_size
funct(args, &ot)               <---also ot

but I never added that last 'file->st.st_size = ot' because I didn't
know it was necessary after the cast.  I'm still not entirely sure why
that line made the difference...I have a vague theory...but I'm
certain I'll find out as I keep reading whichever C book I purchased
from O'Reilly.

Will update bug report tomorrow...and see if anyone's submitted a
report to wherever they're tracking Android NDK stuff.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux