Pointer convention for functions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Pointer convention for functions

Rik-4
jwe,

What do you think about using the spaced out style for function
declarations which return a pointer object?

For example:

corefcn/mexproto.h:78:extern OCTINTERP_API const char *mexFunctionName (void);

I think this would be clearer if it were written as

extern OCTINTERP_API const char * mexFunctionName (void);

This would also be in keeping with our guidelines for declaring functions
which says that the return type should appear alone on the first line
followed by the name of the function and the list of arguments.

extern OCTINTERP_API const char *
mexFunctionName (void)
{
  ...
}

--Rik


Reply | Threaded
Open this post in threaded view
|

Re: Pointer convention for functions

John W. Eaton
Administrator
On 04/24/2017 08:21 PM, Rik wrote:

> jwe,
>
> What do you think about using the spaced out style for function
> declarations which return a pointer object?
>
> For example:
>
> corefcn/mexproto.h:78:extern OCTINTERP_API const char *mexFunctionName (void);
>
> I think this would be clearer if it were written as
>
> extern OCTINTERP_API const char * mexFunctionName (void);
>
> This would also be in keeping with our guidelines for declaring functions
> which says that the return type should appear alone on the first line
> followed by the name of the function and the list of arguments.
>
> extern OCTINTERP_API const char *
> mexFunctionName (void)
> {
>   ...
> }

It looks a little funny to me to have spaces on both sides of the * in
this context, but I don't have a strong preference.

I'm working on a fairly large change that touches nearly all the files
in parse-tree and ten or so more in corefcn and octave-value, so if you
do go ahead with this change, could you wait until after I push my
changes (probably in the next day or so).

Thanks,

jwe