A suggestion

Uh ok – I’m in totally agreement with that. My example was just to demonstrate an alternative to multiple long sequences of tests. Of course one could and should create the table statically…I was just giving an example of how to safely convert the existing source code to a table format without risk.
The regex replacement could just as easily have been

   { $1, $2 },

which would have converted the original if tests into something like

{ ACN15", ambisonicACN15 },
{ ACN16", ambisonicACN16 },
{ ACN17", ambisonicACN17 },
{ ACN18", ambisonicACN18 },
{ ACN19", ambisonicACN19 },
{ ACN20", ambisonicACN20 },
{ ACN21", ambisonicACN21 },

which could be wrapped inside

std::map<String, int>

and that’s your statically declared table, again safely created.

Maybe we were arguing about the wrong issue!

You didn’t read my original post clearly — I was not suggesting the use of regex for anything more than a convenient helper tool at edit time to do the initial conversion of the if tests into a table rather than doing it manually.

1 Like

I have a stupid question for @jules:

Since the acquisition of Raw Material Software by PACE, what is your official role when it comes to JUCE? AFAIK, only @t0m, @reuk and @ed95 are employees of RMS/PACE.

Where do you fit in? Are you a contractor for them now? Or a volunteer? Or?

1 Like

My bad, sorry

That’s really the least important bit of what I was saying - I don’t know if you’re just trolling me now, but I’m getting exasperated with the fact that you don’t seem to get what I’ve said in all my previous posts!

OK, one last time:

ANY kind of runtime initialisation of a container (map, hash, vector, whatever) from constant data would have only negative effects here. It adds extra threading concerns, order-of-initialisation concerns, code bloat, heap allocations, prevents compiler optimisations, and IS NOT GOING TO BE ANY FASTER. In fact I would bet money that for a few dozen items like this it will be SLOWER than a boring list of comparisons. And it will be no less code - in fact, probably MORE code - than a naively-written loop or X macro. It really is a pessimisation, not an optimisation. Please tell me you understand so I can leave this thread!

Jules, we’ve met (at NAMM)— I have nothing but serious respect for you and your achievements. I have a life – I don’t “troll”.

I disagree with some of your positions, based on my own experiences but you know what…if we agreed on everything, one of us wouldn’t be necessary.

I didn’t really expect a suggestions to replace multiple long lists of tests with an object (whatever kind one choose, however one decides to initialize it) to be so controversial.

Feel free to delete the entire topic!

Oh, I only meant that in the sense of “lighthearted teasing”, not accusing you of anything nasty! :slight_smile:

I guess I’m just finding it really odd I answered a seemingly straightforward, non-subjective, non-controversial question, but then hit a wall of failing to convince a couple of people of something that seems pretty self-evidently correct.