My goal is to track an array of Plugin objects whenever a plugin is created:
plugin.h
#ifndef PLUGIN_H
#define PLUGIN_H
class Plugin {
public:
  static byte instances;
  static Plugin plugins[];
  Plugin();
  ~Plugin();
};
#endif
plugin.cpp
#include <Arduino.h>
#include "plugin.h"
#define MAX_PLUGINS 3
byte Plugin::instances = 0;
Plugin Plugin::plugins[MAX_PLUGINS];
Plugin::Plugin() {
  Plugin::plugins[Plugin::instances++] = *this;
}
Plugin::~Plugin(){
}
What I've noticed is that
Plugin Plugin::plugins[MAX_PLUGINS];
Already seems to call the plugin constructor which is not what I want as derived Plugins will only be created later in the program. Same happens if I try to create a empty list:
Plugin Plugin::plugins[MAX_PLUGINS] = {};
How can I create a NULL-initialized array of objects of pre-defined but variable length?
Note: I've read Array of objects with constructor but I'm not sure that's possible in the AVR GCC chain?