You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Bernd Mathiske (JIRA)" <ji...@apache.org> on 2015/12/03 13:50:11 UTC

[jira] [Commented] (MESOS-3795) process::io::write takes parameter as void* which could be const

    [ https://issues.apache.org/jira/browse/MESOS-3795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15037739#comment-15037739 ] 

Bernd Mathiske commented on MESOS-3795:
---------------------------------------

commit 616168229c04c5c2dd08dd5ebff7b089bf2f69c9
Author: Benjamin Bannier <be...@mesosphere.io>
Date:   Thu Dec 3 13:46:41 2015 +0100

    Made parameter type of process::io::write() a const pointer.
    
    This corrects the implementation and avoids C-style casts.
    
    Review: https://reviews.apache.org/r/40737


> 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
>            Assignee: Benjamin Bannier
>              Labels: mesosphere, tech-debt
>
> 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)