[poppler] qt4/src qt4/tests qt5/src qt5/tests

Adam Reichold adam.reichold at t-online.de
Thu Jan 22 11:22:15 PST 2015


Hello again,

Am 22.01.2015 um 19:52 schrieb Albert Astals Cid:
> El Dijous, 22 de gener de 2015, a les 19:47:04, Adam Reichold va escriure:
>> Hello William,
>>
>> Am 22.01.2015 um 01:28 schrieb William Bader:
>>> Is it possible to write "const GBool sWords =
>>> flags.testFlag(WholeWords);" instead of "const GBool sWords =
>>> flags.testFlag(WholeWords) ? gTrue : gFalse;"?
>>
>> I think it is possible as the "bool" value returned by "testFlag" would
>> be casted implicitly to whatever integral type "GBool" could also be,
>> with "true" being 1 and "false" being "0" as mandated by the standard.
>>
>>> It does not give a compile warning with g++ 4.8.3 on Fedora 20,
>>> and goo/gtypes.h has "typedef bool GBool; #define gTrue true #define
>>> gFalse false".  In theory, someone could change the definitions, but
>>> wouldn't it break a lot of tests if gTrue or gFalse were defined so that
>>> C++ considered (gFalse || !gTrue) as true in a condition?
>>
>> But I also think this only works if people always use statements like
>> "GBool x; if(x)" instead of testing "if(x == gTrue)" as "gTrue" could
>> very well be "42" instead of "1" and still keep "if(x)" and "gFalse ||
>> !gTrue == false" working. So as it may be ugly and noisy, it does not
>> cost a lot to write "? gTrue : gFalse" and also cover this case.
>>
>> Personally, I would prefer to just use C++'s standard "bool" and my next
>> question would be what the actual contract behind "GBool" is? Is it
>> guaranteed to always be "bool"? But then why have it all?
> 
> see goo/gtypes.h

Of course, the first place I looked. But I don't understand the comment
about some compilers defining "bool" and "true". Why would I care as
long as they behave as the standard "bool"? (And would be part of that
compilers ABI then?)

> We have it because xpdf had it, and it simplifies merging (btw 3.04 merging is 
> still not even started, if anyone has time...).

The part about merging xpdf make sense but still doesn't explain why
they had it. :-(

Best regards, Adam.

> Cheers,
>   Albert
> 
>>
>> I this particular case, I just tried to stay as close to the existing
>> code as possible, so it may just be cargo culting.
>>
>>> William
>>
>> Best regards, Adam.
>>
> 
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20150122/b968e066/attachment.sig>


More information about the poppler mailing list