Lely core libraries  1.9.2
features.h File Reference

This header file is part of the Lely libraries; it contains the compiler feature definitions. More...

#include <limits.h>
Include dependency graph for features.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _Alignas(x)   __attribute__((__aligned__(x)))
 Specifies the alignment requirement of the declared object or member.
 
#define _Alignof(x)   __alignof__(x)
 Yields the alignment requirement of its operand type.
 
#define _Noreturn   __attribute__((__noreturn__))
 A function declared with a _Noreturn function specifier SHALL not return to its caller.
 
#define _Thread_local   __thread
 An object whose identifier is declared with the storage-class specifier _Thread_local has thread storage duration. More...
 
#define __likely(x)   __builtin_expect(!!(x), 1)
 Indicates to the compiler that the expression is most-likely true. More...
 
#define __unlikely(x)   __builtin_expect(!!(x), 0)
 Indicates to the compiler that the expression is most-likely false. More...
 
#define LONG_BIT   __WORDSIZE
 The number of bits in a long.
 

Detailed Description

This header file is part of the Lely libraries; it contains the compiler feature definitions.

Author
J. S. Seldenthuis jseld.nosp@m.enth.nosp@m.uis@l.nosp@m.ely..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file features.h.

Macro Definition Documentation

◆ _Thread_local

#define _Thread_local   __thread

An object whose identifier is declared with the storage-class specifier _Thread_local has thread storage duration.

Its lifetime is the entire execution of the thread for which it is created, and its stored value is initialized when the thread is started. There is a distinct object per thread, and use of the declared name in an expression refers to the object associated with the thread evaluating the expression.

Definition at line 239 of file features.h.

◆ __likely

#define __likely (   x)    __builtin_expect(!!(x), 1)

Indicates to the compiler that the expression is most-likely true.

Subject to the same considerations as __unlikely().

Definition at line 273 of file features.h.

◆ __unlikely

#define __unlikely (   x)    __builtin_expect(!!(x), 0)

Indicates to the compiler that the expression is most-likely false.

This should only be used in performance-critical sections as compilers are very good at branch prediction nowadays. The only exception to this rule is error and exception checking, e.g. if (__unlikely(!ptr)) { handle NULL pointer }, since we never optimize exceptions.

See also
__likely()

Definition at line 286 of file features.h.