Benjamin Bannier created MESOS-3795:
---------------------------------------
Summary: process::io::write takes parameter as void* which could
be const
Key: MESOS-3795
URL: https://issues.apache.org/jira/browse/MESOS-3795
Project: Mesos
Issue Type: Improvement
Components: libprocess
Reporter: Benjamin Bannier
In libprocess we have
{code}
Future<size_t> write(int fd, void* data, size_t size);
{code}
which expects a non-{{const}} {{void*}} for its {{data}} parameter. Under the
covers {{data}} appears to be handled as a {{const}} (like one would expect
from the signature its inspiration {{::write}}).
This function is not used too often, but since it expects a non-{{const}} value
for {{data}} automatic conversions to {{void*}} from other pointer types are
disabled; instead callers seem cast manually to {{void*}} -- often with C-style
casts.
We should sync this method's signature with that of {{::write}}.
In addition to following the expected semantics of {{::write}}, having this
work without casts with any pointer value {{data}} would make it easier to
interface this with character literals, or raw data ptrs from STL containers
(e.g. {{Container::data}}). It would probably also indirectly eliminate
temptation to use C-casts.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)