Red Hat ENTERPRISE LINUX 3 - USING GCC Using Instructions page 248

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

Advertisement

242
Traditional C allows the following erroneous pair of declarations to appear together in a given
scope:
typedef int foo;
typedef foo foo;
GCC treats all characters of identifiers as significant. According to K&R-1 (2.2), "No more than the
first eight characters are significant, although more may be used.". Also according to K&R-1 (2.2),
"An identifier is a sequence of letters and digits; the first character must be a letter. The underscore
_ counts as a letter.", but GCC also allows dollar signs in identifiers.
PCC allows whitespace in the middle of compound assignment operators such as
ing the ISO standard, does not allow this.
GCC complains about unterminated character constants inside of preprocessing conditionals that
fail. Some programs have English comments enclosed in conditionals that are guaranteed to fail;
if these comments contain apostrophes, GCC will probably report an error. For example, this code
would produce an error:
#if 0
You can't expect this to work.
#endif
The best solution to such a problem is to put the text into an actual C comment delimited by
.
/*...*/
Many user programs contain the declaration
on many systems did not actually declare
clared it to return. But in systems with ISO C headers,
that is not the same as
The solution is to change your program to use appropriate system headers (
with ISO C headers) and not to declare
use
as the return type of
time_t
When compiling functions that return
. If you are concerned with PCC compatibility, you should declare your functions to return
float
; you might as well say what you mean.
double
When compiling functions that return structures or unions, GCC output code normally uses a
method different from that used on most versions of Unix. As a result, code compiled with GCC
cannot call a structure-returning function compiled with PCC, and vice versa.
The method used by GCC is as follows: a structure or union which is 1, 2, 4 or 8 bytes long is
returned like a scalar. A structure or union with any other size is stored into an address supplied by
the caller (usually in a special, fixed register, but on some machines it is passed on the stack). The
machine-description macros
pass this address.
By contrast, PCC on most target machines returns structures and unions of any size by copying
the data into an area of static storage, and then returning the address of that storage as if it were a
pointer value. The caller must copy the data from that memory area to the place where the value is
wanted. GCC does not use this method because it is slower and nonreentrant.
On some newer machines, PCC uses a reentrant convention for all structure and union returning.
GCC on most of these machines uses a compatible convention when returning structures and unions
in memory, but still returns small structures and unions in registers.
You can tell GCC to use a compatible convention for all structure and union returning with the
option
-fpcc-struct-return
GCC complains about program fragments such as
adecimal constants separated by the minus operator. Actually, this string is a single preprocessing
time
, then
long
long time ();
time
.
time
float
STRUCT_VALUE
.
Chapter 11. Known Causes of Trouble with GCC
. In the past, the system header files
long time ();
, so it did not matter what type your program de-
is declared to return
time
is erroneous.
if the system header files declare it, or failing that to
, PCC converts it to a double. GCC actually returns a
and
STRUCT_INCOMING_VALUE
0x74ae-0x4000
. GCC, follow-
+=
time_t
on systems
time.h
tell GCC where to
which appear to be two hex-
, and if

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Enterprise linux 3

Table of Contents