Skip to content

C++ Mode v0.5.0

Choose a tag to compare

@pepc84 pepc84 released this 15 Aug 00:52
· 23 commits to main since this release

Parser fixes

  • Direct-init vs function-declaration ambiguityArray<Ground*> ground(segments) now correctly parses as a variable declaration instead of a function declaration; previously caused "segments is not a type"
  • Pointer-to-array declaratorfloat (*kernels[8])[3] now emits correctly instead of the broken float (*kernels[8][3])()
  • Comparison vs template ambiguityneighbours < 2 || neighbours > 3 and similar expressions no longer trigger false "unexpected token <" errors
  • using std::get removed — was shadowing PApplet::get(), causing get(x, y) to call std::get instead of reading screen pixels and crashing

Build pipeline fixes

  • Template-instantiated variables stay in _PSketchArrayList<Ball> balls and Array<Ground*> ground(segments) are no longer incorrectly hoisted to namespace scope, fixing "not declared in this scope" errors
  • Dependency hoisting fixed — variables referenced only as function calls (e.g. a method named flock() in Boid) are no longer incorrectly hoisted to namespace scope; fixes 'Flock' does not name a type; did you mean 'flock'?
  • Class dependency ordering — hoisted classes are now topologically sorted by member-access dependency; Liquid (which accesses Mover members via pointer params) is correctly emitted after Mover
  • Static sketch variable placement — variables with Processing API calls in their initializer (e.g. PImage* img = loadImage(...)) now go inside setup() instead of at static initialization time, preventing segfaults before the window exists
  • API name conflict detection expanded — variables named circle, square, point, line, image, text, fill, stroke, ambient, specular, arc, box, curve, ellipse, rect, rotate, scale, translate etc. are automatically renamed to avoid shadowing Processing API functions

Linter

  • Now uses the same full build pipeline as the real build, eliminating false positive errors
  • Forward declarations for functions that also have a definition in the same sketch are suppressed, fixing spurious "cannot be overloaded" errors

Engine

  • map() division-by-zero guardmap(v, a, a, ...) where start equals stop now returns the output start value instead of crashing
  • PVector proxy type supportPVector(width, height - 20) inside user-defined classes now compiles correctly; proxy types (_W, _H etc.) now satisfy is_convertible_v<T, float>