Re: C++ help needed fixing VXL on 32 bit architectures

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

 



https://github.com/vxl/vxl/issues/638

Independent of that particular issue, it is hard to believe the claim
"vxl: A multi-platform collection of C++ software libraries ...".
They're not making a good-faith effort to be portable.
The first hint is that "-Werror" (turn all warnings into errors)
has not been used when compiling.

There are so many basic portability errors, such as:

===== portability error 1

v3p/netlib/triangle.c:219:  #define TRIANGLE_PTRINT size_t

        Using #define is silly when typedef is suitable.

v3p/netlib/triangle.c:3685:23: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'unsigned int' [-Wformat=]
   printf("triangle x%lx with orientation %d:\n", (TRIANGLE_PTRINT) t->tri,

        "%zx" solves this problem and has been available for many years.

===== portability error 2

v3p/clipper/clipper.cpp:722:34: warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct ClipperLib::TEdge'

        Learn from the compiler; it is smarter than this programmer.
        (Example: if there are any 'virtual' functions [now or later!],
        then using memset zaps the vtable pointer.)

====== portability error 3

core/vil1/vil1_memory_image_impl.cxx:210:63: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
     return property_value ? (*(bool*)property_value) = true : true;

        This is unmaintainable, especially when not explained in a comment.

===== portability error 4

core/vil1/file_formats/vil1_pnm.cxx:360:11: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
           if ((t&=7)==0) *++ib=0; int a; (*vs_) >> a; if (a) *ib|=static_cast<unsigned char>(1<<(7-t)); }

        Such code is an abomination for lack of clarity.
        Also, the preceding line
                for (int x=0,t=0; x<xs*components_; ++x,++t) {
        suggests that (7 < t) is a possibility, so (1<<(7-t)) will be undefined,
        and the run-time bug will be hard to find.

=====
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux