←back to thread

36 points tanelpoder | 2 comments | | HN request time: 0s | source
Show context
levzettelin ◴[] No.45148093[source]

  // You are responsible for releasing the structure in the end
  arrow_array.release(&arrow_array);
This doesn't look like RAII. How is this idiomatic for C++20? Why do you have to pass a pointer to "this" again as an explicit argument.
replies(2): >>45148279 #>>45149732 #
1. rfoo ◴[] No.45148279[source]
This is the extracted Arrow C data interfaces as documented in https://arrow.apache.org/docs/format/CDataInterface.html

It's not how you interact with the data in your own C++ code, it's for passing this data to other in-process consumers (libraries etc). While in the example it calls the release function, this is usually just passed to a downstream consumer and it's their responsibility to call it.

I agree that having such an example as the first one is confusing. Given that a large part of the point of Apache Arrow is passing data columnar data between libraries in different languages in memory, it makes some sense.

replies(1): >>45150298 #
2. CyberDildonics ◴[] No.45150298[source]
It's not how you interact with the data in your own C++ code, it's for passing this data to other in-process consumers (libraries etc). While in the example it calls the release function, this is usually just passed to a downstream consumer and it's their responsibility to call it.

This seems like a strange rationalizations when you don't need to have explicit release to be able to pass it to something else.