Add [[nodiscard]] to the API

I just spent a bit of time trying to track down why my endpoints were returning 400 all the time. If only:

URL withPOSTData (const String& postData) const;

Was:

[[nodiscard]] URL withPOSTData (const String& postData) const;

I would have saved a bunch of additional gray hairs.

It would be nice if you could go and fix this in the whole JUCE.

2 Likes

I agree, I’ve been wanting to add this to tracktion_engine but it’s C++17 isn’t it?
Maybe a JUCE_NO_DISCARD macro is needed?

3 Likes

I would really love to go and fix it and create a PR myself but i fear i’ll waste my time, as the JUCE team would probably solve this in a different, better way, anyway.