omarss / pdfium

Automatically exported from code.google.com/p/pdfium
0 stars 0 forks source link

FX_BSTRC() isn't needed for modern compilers/ #151

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The FX_BSTRC() macro automatically applies a sizeof()-1 to its argument, so as 
to avoid having to do a strlen in the constructor.  But compilers will optimize 
strlen("foo") => 3, so long as the strlen is visible to it in the header.

(I believe blink relies on this exact behaviour).

Even if not, there are better ways to trick a C++ compiler into deducing a 
string length.

Having this littered throughout the code base reduces readability; also it's 
not used consistently where it would be needed.

Original issue reported on code.google.com by tsepez@chromium.org on 5 May 2015 at 8:31