octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Positioning GCC_ATTR_DEPRECATED


From: John W. Eaton
Subject: Re: Positioning GCC_ATTR_DEPRECATED
Date: Sun, 27 Dec 2015 19:34:50 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0

On 12/26/2015 11:20 PM, Rik wrote:
12/26/15

jwe,

We are making use of GCC's attribute mechanism in various forms.  Normally
the attribute is just a small hint to the compiler and its position in the
declaration (at the very end) reflects its low importance.  However, for
deprecated functions the fact that the attribute could be at the far end of
a multi-line declaration can make it easy to miss.  Why not move the
attribute to the front of the function so as a programmer is skimming the
list of member functions to a class it is quite clear that this function
should not be used?

I would not have necessarily thought of this, but for the fact that this is
already being done in ov.h.  For example,

GCC_ATTR_DEPRECATED octave_idx_type capacity (void) const

versus

octave_value (const charMatrix& chm, bool is_string,
               char type = '\'') GCC_ATTR_DEPRECATED;

I didn't realize that it could be anywhere except the end. If it can be at the beginning, then move it there. May as well move all of them. How about putting it at the beginning on a separate line?

jwe





reply via email to

[Prev in Thread] Current Thread [Next in Thread]