emacs-devel
[Top][All Lists]
Advanced

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

Re: Suspicious warning in W64 build


From: Andy Moreton
Subject: Re: Suspicious warning in W64 build
Date: Mon, 18 Sep 2017 18:58:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (windows-nt)

On Mon 18 Sep 2017, Paul Eggert wrote:

> Eli Zaretskii wrote:
>> It expands into an assignment, so it's an assignment.
>
> UNINIT does not expand into an assignment. Sometime it expands into nothing.
> At other times it expands into '=' followed by an initializer. Neither is an
> assignment. And either way, the user of UNINIT is not supposed to care what
> UNINIT expands into; that's an implementation detail. From the user's point of
> view, UNINIT is a declarator attribute.
>
> There are lots more syntactically-incorrect macros other than the UNINIT and
> the ATTRIBUTE_* ones. They include DECLARE_POINTER_ALIAS, FALLTHROUGH, INLINE,
> FOR_EACH_TAIL, and the list goes on and on. I agree that we should avoid such
> constructs if possible, but each of these constructs is useful and is
> unavoidably outside the usual C syntax. UNINIT is similar.

However the whole idea of UNINIT is dubious, and invites overly clever
compilers to exploit undefined behaviour in the name of optimisation,
and emit broken code that does not meet the expectations of the
programmer.

If the compiler complains about an uninitialised use, then fix the code to
initialise the variable and remove the UB rather than disguising it with
an UNINIT macro.

    AndyM




reply via email to

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