Compile failure (clang): "variable length array" errors in box3d.cpp
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
Fix Released
|
Medium
|
ideasman42 |
Bug Description
Building inkscape-0.48.0 on OS X 10.7 using clang from XCode4.2 fails:
box3d.cpp:463:25: error: variable length array of non-POD element type 'Geom::Point'
Geom::Point snap_pts[
The code is one of several places in that source file with the following pattern:
int num_snap_lines = (id != -1) ? 3 : 4;
Geom::Point snap_pts[
where id is a parameter passed to the function that contains this code. Sure enough, variable-length arrays are part of the c99 standard but not part of the c++ standard (though gcc seems to allow it). I don't know how widespread this use is in inkscape, but for box3d.cpp, it appears it's just used for creating some local variables within box3d_snap(), so it would probably suffice to hardcode the arrays to be the largest possibly-needed size (and then just not use all the elements in some cases).
tags: | added: build |
Changed in inkscape: | |
status: | Fix Committed → Fix Released |
<off-topic>
> Building inkscape-0.48.0 on (…)
Unrelated to which compiler is used and whether Inkscape compiles on any platform with clang - any reason not to use the latest bug-fix release 0.48.2?
</off-topic>
> (…) on OS X 10.7 using clang from XCode4.2 fails
AFAIK the Portfile for Inkscape in Mac Ports does force the usage of 'llvm-gcc-4.2' on Lion [2] for now.
Related discussions on the mailing list about building Inkscape [1] with clang: thread. gmane.org/ gmane.comp. graphics. inkscape. devel/36760> thread. gmane.org/ gmane.comp. graphics. inkscape. devel/37024>
<http://
<http://
[1] probably Inkscape trunk, not the stable release branch /trac.macports. org/browser/ trunk/dports/ graphics/ inkscape/ Portfile# L87>
[2] <https:/