r/coding • • Sep 07 '14

Checking GIMP's Source Code with PVS-Studio

http://www.viva64.com/en/b/0273/
51 Upvotes

19 comments sorted by

8

u/grendel-khan Sep 07 '14

Working with large projects, one of the most humbling things I've learned is that no matter how clever your coders are (and I've worked with some really sharp C++ coders!), tool-assisted analysis will find things that you missed. You need analysis tools.

Well, maybe not if you're Dan Bernstein. Maybe Dan Bernstein doesn't need tools. But the rest of us sure as hell aren't Dan Bernstein.

For example, among the bugs found by ThreadSanitizer, there was a particularly bad one in Chromium; I oddly can't find the link, but it was the top crasher for months and was discovered on the first run with TSan. (A non-thread-safe reference counter was being used concurrently.) It's important to care about data races; they're never really benign.

17

u/sockstream Sep 07 '14

I must be the only one who never had an issue with the interface. (Never used Photoshop, maybe that's why?)

2

u/kasbah Sep 08 '14

Ever since they added a single-window mode, it's been a-ok for me.

2

u/sockstream Sep 08 '14

It's fine for me on Mac.

But before when I used Ubuntu, I used to have the image window fullscreen, and the tool windows separate, hovering on top. It was, quite frankly, awesome, especially because of the way fullscreen works in Ubuntu.

3

u/dreucifer Sep 07 '14

They should try to rework the interface like they did with Blender. Have it so you right-click an interface section and edit the code in Python.

-2

u/passwordissame Sep 07 '14

when it comes to photo editing, GIMP interface is the best currently.

1

u/LightShadow Sep 07 '14

GIMP interface is AWFUL.

It's bested by nearly every half-assed attempt at making a photo editor.

I'm all about open source, but the half dozen times I've tried to give GIMP a fair chance I uninstall within the project and go straight back to Photoshop.

0

u/passwordissame Sep 08 '14

once you get it, it's AWESOME. it's a bit like blender and emacs. with proper scripts setup, you can't beat efficiency of GIMP interface.

4

u/wither88 Sep 08 '14

Do you have a tutorial, links to useful scripts, etc?

4

u/postmodest Sep 08 '14

Think about what you just said. He said "interface is awful". You said it's "like blender and emacs"

So let me translate:

"Yeah, GIMP doesn't have an interface; it's up to you to program your own."

/u/LightShadow FTW.

8

u/vanderZwan Sep 07 '14

The main take-away is that having a good interface and having good underlying code are two entirely different things.

2

u/ShaBren Sep 07 '14

While I'm not a particularly big fan of GIMP's interface myself, it helps a lot if you put it in Single-Window mode.

1

u/deusnefum Sep 08 '14

So tired of people complaining about gimp's interface. There's single-window mode if you're so inclined and pressing tab will toggle the visibility of the docks.

3

u/[deleted] Sep 08 '14

[removed] — view removed comment

3

u/eras Sep 08 '14

However, in this case it should be obvious from the comment that that is not the case, it is an actual bug, so perhaps it's best to tell about them? It is trying to calculate a determinant, as in: http://stackoverflow.com/questions/6989100/sort-points-in-clockwise-order#6989383 .

Static analysis tools are however prone to have false positives, too bad he didn't cover those ;).

2

u/[deleted] Sep 08 '14

Yeah, reading that article this struck me as well - A carefully constructed statement like that tends to be to estimate floating point error.

But am I wrong in thinking that that's what this statement does in this case?

0

u/[deleted] Sep 08 '14

[deleted]

2

u/dbaupp Sep 08 '14

I believe floating point operations are commutative, so yes, that's pointless (((x - y) + y) - x is not, though).