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: Tue, 29 Dec 2015 16:33:05 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0

On 12/29/2015 03:56 PM, Rik wrote:

I think it's a good idea to rename to OCTAVE_ATTR_NORETURN.  But, I would
prefer to keep this attribute at the end of the declaration if possible.

It is possible to place (the C++11 standard) [[noreturn]] attribute at either the beginning or end of the declaration or definition. For the GCC-specific __attribute__((noreturn)), it can't go at the end of definitions, so then we must provide a separate declaration if we want to put the attribute at the end. So do we sometimes put these attributes at the beginning and sometimes at the end? It seems complicated to remember and describe this in our coding standards. It would be much simpler to just say "put them at the beginning".

Yeah, it does get kind of messy if we are writing things like

  extern OCTAVE_ATTR_NORETURN OCTAVE_API void
  foobar (args, ...);

or

  extern OCTAVE_API void
  foobar (args, ...) OCTAVE_ATTR_NORETURN;

I don't really see that one is better than the other.

Note that the OCTAVE_API macro is also an attribute. It is currently only used on Windows systems but we should probably also use visibility attributes on other systems that support them.

jwe




reply via email to

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