pavlin-policar / openTSNE

Extensible, parallel implementations of t-SNE
https://opentsne.rtfd.io
BSD 3-Clause "New" or "Revised" License
1.48k stars 165 forks source link

error: cast from pointer to smaller type 'int' loses information #264

Open yurivict opened 3 weeks ago

yurivict commented 3 weeks ago
openTSNE/dependencies/annoy/annoymodule.cc:180:12: error: cast from pointer to smaller type 'int' loses information
  180 |     return (int) NULL;
      |            ^~~~~~~~~~
1 error generated.
error: command '/usr/local/libexec/ccache/cc' failed with exit code 1

ERROR Backend subprocess exited when trying to invoke build_wheel

In C++ NULL is for a null pointer, and it isn't castable to int.

The code around this line actually doesn't make sense: it returns 0 regardless of the comparison result.

pavlin-policar commented 3 weeks ago

Thanks for reporting this. This particular piece of code comes from Annoy, one of our dependencies, and you should probably bring up the issue with them. I don't know this code at all, and it's basically copy/pasted into the codebase here to prevent any backwards compatibility issues.

But, looking at their code, is looks like they have this particular section as well https://github.com/spotify/annoy/blob/main/src/annoymodule.cc#L176-L184, so they would probably appreciate the bug report! And, if they fix it, I'll update the annoy code here as well to keep annoy up to date.