igorski / MWEngine

Audio engine and DSP library for Android, written in C++ providing low latency performance within a musical context, while providing a Java/Kotlin API. Supports both OpenSL and AAudio.
MIT License
261 stars 45 forks source link

C++ Convention - 0 used as null pointer #74

Closed teotigraphix closed 5 years ago

teotigraphix commented 5 years ago

Is this legacy in the code that you use 0 as nullptr?

I am coding convention OCD sometimes and I have read not using nullptr is bad form.

Here again, I am just getting into the deeper nuances of C++ now and I want to do things correct.

igorski commented 5 years ago

That's an interesting observation, in previous NDK versions nullptr wasn't part of the STL of choice nor language level (which is hardly an excuse as it was a #define away). To me, the biggest problem is that it is confusing to determine whether the code refers to an actual numerical 0 instead of "unallocated memory space" (even though they imply the same on a technical level, it doesn't help code understanding).

teotigraphix commented 5 years ago

Yes, it was due to the fact your code reads so well and the 0 for nullptr was like not having a period or comma.

Nothing earth shattering but, you know. :)