Hex Floats; Arrays Of Length Zero - Red Hat ENTERPRISE LINUX 3 - USING GCC Using Instructions

Using the gnu compiler collection (gcc)
Hide thumbs Also See for ENTERPRISE LINUX 3 - USING GCC:
Table of Contents

Advertisement

Chapter 6. Extensions to the C Language Family
To write a constant with a complex data type, use the suffix
For example,
2.5fi
always has a pure imaginary value, but you can form any complex value you like by adding one to a
real constant. This is a GNU extension; if you have an ISO C99 conforming C library (such as GNU
libc), and want to construct complex constants of floating type, you should include
and use the macros
I
To extract the real part of a complex-valued expression
to extract the imaginary part. This is a GNU extension; for values of floating type, you
__imag__
should use the ISO C99 functions
in
and also provided as built-in functions by GCC.
complex.h
The operator
performs complex conjugation when used on a value with a complex type. This is a
~
GNU extension; for values of floating type, you should use the ISO C99 functions
, declared in
conjl
GCC can allocate complex automatic variables in a noncontiguous fashion; it is even possible for the
real part to be in a register while the imaginary part is on the stack (or vice-versa). Only the DWARF2
debug info format can represent this, so use of DWARF2 is recommended. If you are using the stabs
debug info format, GCC describes a noncontiguous complex variable as if it were two separate vari-
ables of noncomplex type. If the variable's actual name is
and
foo$real
foo$imag

6.11. Hex Floats

ISO C99 supports floating-point numbers written not only in the usual decimal notation, such as
, but also numbers such as
1.55e1
GCC supports this in C89 mode (except in some cases when strictly conforming) and in C++. In that
format the
hex introducer and the
0x
number that indicates the power of 2 by which the significant part will be multiplied. Thus
1 15/16,
multiplies it by 8, and the value of
p3
Unlike for floating-point numbers in the decimal notation the exponent is always required in the
hexadecimal notation. Otherwise the compiler would not be able to resolve the ambiguity of, e.g.,
. This could mean
0x1.f
type
.
float

6.12. Arrays of Length Zero

Zero-length arrays are allowed in GNU C. They are very useful as the last element of a structure which
is really a header for a variable-length object:
struct line {
int length;
char contents[0];
};
struct line *thisline = (struct line *)
malloc (sizeof (struct line) + this_length);
thisline- length = this_length;
In ISO C90, you would have to give
complicate the argument to
In ISO C99, you would use a flexible array member, which is slightly different in syntax and seman-
tics:
has type
_Complex float
or
instead.
_Complex_I
crealf
and also provided as built-in functions by GCC.
complex.h
. You can examine and set these two fictitious variables with your debugger.
0x1.fp3
or
p
or
1.0f
1.9375
contents
.
malloc
i
and
has type
3i
, write
exp
,
,
,
creal
creall
cimagf
, the two fictitious variables are named
foo
written in hexadecimal format. As a GNU extension,
exponent field are mandatory. The exponent is a decimal
P
is the same as
0x1.fp3
since
is also the extension for floating-point constants of
f
a length of 1, which means either you waste space or
or
(either one; they are equivalent).
j
. Such a constant
_Complex int
__real__
exp
,
and
cimag
cimagl
conjf
.
1.55e1
129
complex.h
. Likewise, use
, declared
,
and
conj
is
0x1.f

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ENTERPRISE LINUX 3 - USING GCC and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Enterprise linux 3

Table of Contents